On Thu, Jun 08 2017, Steve Dickson wrote: > When the nfs4 filesystem specified, the default major > and minor versions should be used. > > Signed-off-by: Steve Dickson <steved@xxxxxxxxxx> Hi Steve, I think this is definitely heading in the right direction. I particularly like that you've #defined for the default major/minor. However as I reflected on it, I realised that "-o v4" needs to set the same version as "-t nfs4", and even with this patch it doesn't. I think we need to focus on nfs_default_version() and make sure it does the right thing. If v.mode == V_DEFAULT, we need to copy both 'major' and 'minor' from config_default_vers if they are set. If config_default_vers.v_mode == V_GENERAL, .minor won't be set so in that case we need to use NFS_DEFAULT_MINOR; If v.mode == V_GENERAL, then only copy the minor if it is set and the major is correct. So we need to check for V_SPECIFIC, and other wise use the default minor. If v.mode == V_SPECIFIC, nfs_default_version isn't called, so it doesn't matter. I think this gets it right... Thoughts? Thanks, NeilBrown diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index c0266e51ad1c..7dfdd9e62115 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -73,6 +73,13 @@ #define NFS_DEF_BG_TIMEOUT_MINUTES (10000u) #endif +#ifndef NFS_DEFAULT_MAJOR +#define NFS_DEFAULT_MAJOR 4 +#endif +#ifndef NFS_DEFAULT_MINOR +#define NFS_DEFAULT_MINOR 2 +#endif + extern int nfs_mount_data_version; extern char *progname; extern int verbose; @@ -110,22 +117,27 @@ static void nfs_default_version(struct nfsmount_info *mi) } if (mi->version.v_mode == V_DEFAULT && - config_default_vers.v_mode != V_DEFAULT) { + config_default_vers.v_mode != V_DEFAULT) { mi->version.major = config_default_vers.major; - mi->version.minor = config_default_vers.minor; + if (config_default_vers.v_mode == V_SPECIFIC) + mi->version.minor = config_default_vers.minor; + else + mi->version.minor = NFS_DEFAULT_MINOR; return; } if (mi->version.v_mode == V_GENERAL) { - if (config_default_vers.v_mode != V_DEFAULT && + if (config_default_vers.v_mode == V_SPECIFIC && mi->version.major == config_default_vers.major) mi->version.minor = config_default_vers.minor; + else + mi->version.minor = NFS_DEFAULT_MINOR; return; } #endif /* MOUNT_CONFIG */ - mi->version.major = 4; - mi->version.minor = 2; + mi->version.major = NFS_DEFAULT_MAJOR; + mi->version.minor = NFS_DEFAULT_MINOR; } /*
Attachment:
signature.asc
Description: PGP signature