Remove NFS v2 support from the client and server
Subsystems (2)
cover Remove NFS v2 support from the client and server
These patches will remove the all references and
support of NFS v2 in both the server and client.
On server side the support has been off, by default, since 2013 (6b4e4965a6b). With this server patch the ability to enable v2 will be remove.
Currently even with CONFIG_NFS_V2 not set
v2 mounts are still tied (over-the-wire). I looked at creating a kernel parameter module so support could re-enabled but that got ugly quick.
So I just decided to make all V2 mounts fail with
EOPNOTSUPP, with no way of turn them back on.
Steve Dickson (3):
nfsd: Remove the ability to enable NFS v2. nfs.man: Remove references to NFS v2 from the man pages
mount: Remove NFS v2 support from mount.nfs
nfs.conf | 1 - utils/mount/configfile.c | 2 +- utils/mount/mount.nfs.man | 2 +- utils/mount/network.c | 4 ++-- utils/mount/nfs.man | 20 +++----------------- utils/mount/nfsmount.conf | 2 +- utils/mount/stropts.c | 3 +++ utils/nfsd/nfsd.c | 2 -- utils/nfsd/nfsd.man | 4 ++-- 9 files changed, 13 insertions(+), 27 deletions(-)
Signature · 1 line
2.31.1
RFC PATCH 1/3 nfsd: Remove the ability to enable NFS v2.
--- nfs.conf | 1 - utils/nfsd/nfsd.c | 2 -- utils/nfsd/nfsd.man | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-)
nfs.conf +0 -1
@@ -68,7 +68,6 @@ # lease-time=90 # udp=n # tcp=y -# vers2=n # vers3=y # vers4=y # vers4.0=y
utils/nfsd/nfsd.c +0 -2
@@ -226,7 +226,6 @@ main(int argc, char **argv) }/* FALLTHRU */ case 3 : -case 2 :NFSCTL_VERUNSET (versbits, c);break ;default :
@@ -251,7 +250,6 @@ main(int argc, char **argv) minorvers = minorversset = minormask;/* FALLTHRU */ case 3 : -case 2 :NFSCTL_VERSET (versbits, c);break ;default :
utils/nfsd/nfsd.man +2 -2
@@ -57,7 +57,7 @@ This option can be used to request that .B rpc.nfsd does not offer certain versions of NFS. The current version of .B rpc.nfsd -can support major NFS versions 2,3,4 and the minor versions 4.0, 4.1 and 4.2. +can support major NFS versions 3,4 and the minor versions 4.0, 4.1 and 4.2. .TP .B \-s " or " \-\-syslog By default,
@@ -84,7 +84,7 @@ This option can be used to request that .B rpc.nfsd offer certain versions of NFS. The current version of .B rpc.nfsd -can support major NFS versions 2,3,4 and the minor versions 4.0, 4.1 and 4.2. +can support major NFS versions 3,4 and the minor versions 4.0, 4.1 and 4.2. .TP .B \-L " or " \-\-lease-time seconds Set the lease-time used for NFSv4. This corresponds to how often
Signature · 1 line
2.31.1
RFC PATCH 2/3 nfs.man: Remove references to NFS v2 from the man pages
In reply to Steve Dickson--- utils/mount/mount.nfs.man | 2 +- utils/mount/nfs.man | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-)
utils/mount/mount.nfs.man +1 -1
@@ -27,7 +27,7 @@ can mount all NFS file system versions. Under earlier Linux kernel versions, .BR mount.nfs4 must be used for mounting NFSv4 file systems while .BR mount.nfs -must be used for NFSv3 and v2. +must be used for NFSv3. .SH OPTIONS .TP
utils/mount/nfs.man +3 -17
@@ -12,7 +12,7 @@ created by Sun Microsystems in 1984. NFS was developed to allow file sharing between systems residing on a local area network. Depending on kernel configuration, the Linux NFS client may -support NFS versions 2, 3, 4.0, 4.1, or 4.2. +support NFS versions 3, 4.0, 4.1, or 4.2. .P The .BR mount (8)
@@ -954,11 +954,6 @@ file. See .BR nfsmount.conf(5) for details. .SH EXAMPLES -To mount an export using NFS version 2, -use the -.B nfs -file system type and specify the -.B nfsvers=2 mount option. To mount using NFS version 3, use the
@@ -985,13 +980,6 @@ reasonable defaults for NFS behavior. server:/export /mnt nfs defaults 0 0 .fi .P -Here is an example from an /etc/fstab file for an NFS version 2 mount over UDP. -.P -.nf -.ta 8n +16n +6n +6n +30n - server:/export /mnt nfs nfsvers=2,proto=udp 0 0 -.fi -.P This example shows how to mount using NFS version 4 over TCP with Kerberos 5 mutual authentication. .P
@@ -1084,7 +1072,7 @@ and can safely be allowed to default to the largest values supported by both client and server, independent of the network's MTU size. .SS "Using the mountproto mount option" -This section applies only to NFS version 2 and version 3 mounts +This section applies only to NFS version 3 mounts since NFS version 4 does not use a separate protocol for mount requests. .P
@@ -1487,7 +1475,7 @@ the use of the mount option. .SS "Using file locks with NFS" The Network Lock Manager protocol is a separate sideband protocol -used to manage file locks in NFS version 2 and version 3. +used to manage file locks in NFS version 3. To support lock recovery after a client or server reboot, a second sideband protocol -- known as the Network Status Manager protocol --
@@ -1907,8 +1895,6 @@ RFC 768 for the UDP specification. .br RFC 793 for the TCP specification. .br -RFC 1094 for the NFS version 2 specification. -.br RFC 1813 for the NFS version 3 specification. .br RFC 1832 for the XDR specification.
Signature · 1 line
2.31.1
RFC PATCH 3/3 mount: Remove NFS v2 support from mount.nfs
In reply to Steve DicksonThis patch removes the ability to do NFS v2
mounts. They will now fail with EOPNOTSUPP.
--- utils/mount/configfile.c | 2 +- utils/mount/network.c | 4 ++-- utils/mount/nfsmount.conf | 2 +- utils/mount/stropts.c | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-)
utils/mount/configfile.c +1 -1
@@ -71,7 +71,7 @@ struct mnt_alias {int mnt_alias_sz = (sizeof (mnt_alias_tab)/sizeof (mnt_alias_tab[0 ]));static const char *version_keys[] = { -"v2" ,"v3" ,"v4" ,"vers" ,"nfsvers" ,"minorversion" ,NULL +"v3" ,"v4" ,"vers" ,"nfsvers" ,"minorversion" ,NULL };static int strict;
utils/mount/network.c +2 -2
@@ -97,7 +97,7 @@ static const char *nfs_transport_opttbl[] = { };static const char *nfs_version_opttbl[] = { -"v2" , +"v2" ,/* no longer supported */ "v3" ,"v4" ,"vers" ,
@@ -1286,7 +1286,7 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *velse if (found <0 )return 1 ;else if (found <=2 ) { -/* v2, v3, v4 */ +/* v3, v4 */ version_val = version_key +1 ; version->v_mode =V_SPECIFIC ; }else if (found >2 ) {
utils/mount/nfsmount.conf +1 -1
@@ -28,7 +28,7 @@ # This statically named section defines global mount # options that can be applied on all NFS mount. # -# Protocol Version [2,3,4] +# Protocol Version [3,4] # This defines the default protocol version which will # be used to start the negotiation with the server. # Defaultvers=4
utils/mount/stropts.c +3 -0
@@ -357,6 +357,7 @@ static int nfs_insert_sloppy_option(struct mount_options *options)static int nfs_set_version (struct nfsmount_info *mi) { +if (!nfs_nfs_version (mi->type, mi->options, &mi->version))return 0 ;
@@ -1017,6 +1018,8 @@ static int nfs_try_mount(struct nfsmount_info *mi)switch (mi->version.major) {case 2 : + errno =EOPNOTSUPP ; +break ;case 3 : result =nfs_try_mount_v3v2 (mi, FALSE);break ;
Signature · 1 line
2.31.1
Quoted 2 lines · Steve Dickson
These patches will remove the all references and
support of NFS v2 in both the server and client.
What is the motivation for this?
I don't necessarily disagree, but I'm curious as to what you hope to gain.
Thanks,
NeilBrown
Quoted 33 lines
On server side the support has been off, by default, since 2013 (
6b4e4965a6b). With this server patch the ability to enable v2 will be remove.Currently even with
CONFIG_NFS_V2not set
v2 mounts are still tied (over-the-wire). I looked at creating a kernel parameter module so support could re-enabled but that got ugly quick.So I just decided to make all V2 mounts fail with
EOPNOTSUPP, with no way of turn them back on.Steve Dickson (3):
nfsd: Remove the ability to enable NFS v2. nfs.man: Remove references to NFS v2 from the man pages
mount: Remove NFS v2 support from mount.nfsnfs.conf | 1 - utils/mount/configfile.c | 2 +- utils/mount/mount.nfs.man | 2 +- utils/mount/network.c | 4 ++-- utils/mount/nfs.man | 20 +++----------------- utils/mount/nfsmount.conf | 2 +- utils/mount/stropts.c | 3 +++ utils/nfsd/nfsd.c | 2 -- utils/nfsd/nfsd.man | 4 ++-- 9 files changed, 13 insertions(+), 27 deletions(-)Signature · 1 line
2.31.1
Hey!
Quoted 7 lines · NeilBrown
Quoted 2 lines · Steve Dickson
These patches will remove the all references and
support of NFS v2 in both the server and client.What is the motivation for this?
I don't necessarily disagree, but I'm curious as to what you hope to gain.
Just to eliminate v2 support once and for all... It is a dead version, IMHO, so I'm just trying to clean things up by remove it from the man pages and error out (on the client), if a v2 mount is tried...
We are coming out with a major fairly soon, so I'm just trying make it clear v2 is no longer an option... So I wanted to more eyes on what we are thinking of doing.
steved.
Quoted 38 lines
Thanks,
NeilBrownQuoted 33 lines
On server side the support has been off, by default, since 2013 (
6b4e4965a6b). With this server patch the ability to enable v2 will be remove.Currently even with
CONFIG_NFS_V2not set
v2 mounts are still tied (over-the-wire). I looked at creating a kernel parameter module so support could re-enabled but that got ugly quick.So I just decided to make all V2 mounts fail with
EOPNOTSUPP, with no way of turn them back on.Steve Dickson (3):
nfsd: Remove the ability to enable NFS v2. nfs.man: Remove references to NFS v2 from the man pages
mount: Remove NFS v2 support from mount.nfsnfs.conf | 1 - utils/mount/configfile.c | 2 +- utils/mount/mount.nfs.man | 2 +- utils/mount/network.c | 4 ++-- utils/mount/nfs.man | 20 +++----------------- utils/mount/nfsmount.conf | 2 +- utils/mount/stropts.c | 3 +++ utils/nfsd/nfsd.c | 2 -- utils/nfsd/nfsd.man | 4 ++-- 9 files changed, 13 insertions(+), 27 deletions(-)Signature · 1 line
2.31.1
Quoted 9 lines · Steve Dickson
These patches will remove the all references and
support of NFS v2 in both the server and client.On server side the support has been off, by default, since 2013 (
6b4e4965a6b). With this server patch the ability to enable v2 will be remove.Currently even with
CONFIG_NFS_V2not set
v2 mounts are still tied (over-the-wire).
So the client is running a kernel built with CONFIG_NFS_V2 not set, and you're still seeing it send NFSv2 calls?
That's very weird.
Quoted 2 lines
I looked at creating a kernel parameter module so support could re-enabled but that got ugly quick.
I don't think there's much point to a module parameter.
One other thing we might want to do is provide a way for distros to configure out support on the server side too. That'd help confirm that people really aren't using it before we tear it out completely.
E.g., untested, and should probably remove more than this, but as a start:
fs/nfsd/Kconfig +10 -0
@@ -35,6 +35,16 @@ config NFSD_V2_ACL bool depends on NFSD +config NFSD_V2 + bool "NFS server support for NFS version 2" + depends on NFSD + help + This option enables server support for version 2 of the NFS + protocol. This version has significant limitations and is no + longer widely used. + + If unsure, say N. + config NFSD_V3 bool "NFS server support for NFS version 3" depends on NFSD
fs/nfsd/nfssvc.c +2 -0
@@ -116,7 +116,9 @@ static struct svc_stat nfsd_acl_svcstats = {#endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ static const struct svc_version *nfsd_version[] = { +#if defined(CONFIG_NFSD_V2) [2 ] = &nfsd_version2, +#endif #if defined(CONFIG_NFSD_V3) [3 ] = &nfsd_version3, #endif