]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Refactor mount version and protocol autonegotiation
authorChuck Lever <chuck.lever@oracle.com>
Thu, 16 Sep 2010 11:26:07 +0000 (07:26 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 16 Sep 2010 11:29:35 +0000 (07:29 -0400)
Clean up.

I'm beginning to agree with Bruce and Steve's assessment that the
fallthrough switch case in nfs_try_mount() is more difficult to read
and understand than it needs to be.  The logic that manages
negotiating NFS version and protocol settings is getting more complex
over time anyway.

So let's split the autonegotiation piece out of nfs_try_mount().

We can reduce indenting, and use cleaner switch-based logic.  Also,
adding more comments can only help.

Neil also suggested replacing the pre-call "errno = 0" trick.  The
lower-level functions may try to mount several times (given a list of
addresses to try).  errno could be set by any of those.  The mount
request will succeed at some point, and "success" is returned, but
errno is still set to some non-zero value.

The kernel version check in nfs_try_mount() is more or less loop
invariant: it's impossible for the result of that test to change
between retries.  So we should be able to safely move it to the logic
that sets the initial value of mi->version.

This patch is not supposed to cause a behavioral change.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>

No differences found