mount.nfs: Ignore vers=4
Subsystems (2)
PATCH 1/1 mount.nfs: Ignore vers=4
Since mount.nfs looks at the vers= option to determine pmap parameters when negotiating, it throws EINVAL if "4" is specified, even if the kernel supports vers=4 for "nfs" type file systems.
Teach mount.nfs to ignore vers=4 and just pass the options to the kernel.
Also fix up umount.nfs to skip the UMNT call for vers=4 mounts.
---
utils/mount/network.c | 12 ++++++++---- utils/mount/nfsumount.c | 4 ++++ utils/mount/stropts.c | 6 ++++++ 3 files changed, 18 insertions(+), 4 deletions(-)
utils/mount/network.c +8 -4
@@ -90,6 +90,7 @@ static const char *nfs_transport_opttbl[] = {static const char *nfs_version_opttbl[] = {"v2" ,"v3" , +"v4" ,"vers" ,"nfsvers" ,NULL ,
@@ -1215,10 +1216,13 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case 1 :/* v3 */ *version =3 ;return 1 ; -case 2 :/* vers */ +case 2 :/* v4 */ + *version =4 ; +return 1 ; +case 3 :/* vers */ switch (po_get_numeric (options,"vers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ; }
@@ -1229,10 +1233,10 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case PO_BAD_VALUE :return 0 ; } -case 3 :/* nfsvers */ +case 4 :/* nfsvers */ switch (po_get_numeric (options,"nfsvers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ; }
utils/mount/nfsumount.c +4 -0
@@ -179,6 +179,10 @@ static int nfs_umount_do_umnt(struct mount_options *options,return EX_FAIL ; } +/* Skip UMNT call for vers=4 mounts */ +if (nfs_pmap.pm_vers ==4 ) +return EX_SUCCESS ; + *hostname =nfs_umount_hostname (options, *hostname);if (!*hostname) {nfs_error (_ ("%s: out of memory" ), progname);
utils/mount/stropts.c +6 -0
@@ -438,6 +438,7 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)/* * Extract just the options needed to contact server. * Bail now if any of these have bad values. +* Skip probing the server if this is a vers=4 mount */ if (!nfs_extract_server_addresses (options, nfs_saddr, &nfs_salen, mnt_saddr, &mnt_salen)) {
@@ -448,6 +449,11 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options) errno =EINVAL ;return 0 ; } +if (nfs_pmap.pm_vers ==4 ) { +if (!nfs_append_clientaddr_option (nfs_saddr, nfs_salen, options)) + errno =EINVAL ; + goto out; + }/* * The kernel NFS client doesn't support changing the RPC
A message that is not in the archive (sent off-list or not yet received): 20090830163617.4608.48355.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org
Quoted 5 lines · Chuck Lever
Since mount.nfs looks at the vers= option to determine pmap parameters when negotiating, it throws EINVAL if "4" is specified, even if the kernel supports vers=4 for "nfs" type file systems.
Teach mount.nfs to ignore vers=4 and just pass the options to the kernel.
How will mount.nfs know that the kernel now supports the "vers=4" option?
steved
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Steve Dickson
Quoted 5 lines · Chuck Lever
Since mount.nfs looks at the vers= option to determine pmap parameters when negotiating, it throws EINVAL if "4" is specified, even if the kernel supports vers=4 for "nfs" type file systems.
Teach mount.nfs to ignore vers=4 and just pass the options to the kernel.
How will mount.nfs know that the kernel now supports the "vers=4" option?
The same way it knows after we add any new text-based feature... The option will be passed down, and if the kernel supports it, it will work. If not, mount(2) will return EINVAL, and the mount.nfs command will report the problem.
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com