From: Chuck Lever Date: Thu, 16 Sep 2010 11:26:07 +0000 (-0400) Subject: mount.nfs: Refactor mount version and protocol autonegotiation X-Git-Tag: nfs-utils-1-2-3-rc6~14 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;ds=sidebyside;h=6f73daf5a5711dc0620f7d43c61c4fd57c0d3f80;hp=6f73daf5a5711dc0620f7d43c61c4fd57c0d3f80;p=nfs-utils.git mount.nfs: Refactor mount version and protocol autonegotiation 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 Signed-off-by: Steve Dickson ---