Commit 2f3a4b2a authored by Jeff Layton's avatar Jeff Layton Committed by Chuck Lever

nfsd: allow disabling NFSv2 at compile time

rpc.nfsd stopped supporting NFSv2 a year ago. Take the next logical
step toward deprecating it and allow NFSv2 support to be compiled out.

Add a new CONFIG_NFSD_V2 option that can be turned off and rework the
CONFIG_NFSD_V?_ACL option dependencies. Add a description that
discourages enabling it.

Also, change the description of CONFIG_NFSD to state that the always-on
version is now 3 instead of 2.

Finally, add an #ifdef around "case 2:" in __write_versions. When NFSv2
is disabled at compile time, this should make the kernel ignore attempts
to disable it at runtime, but still error out when trying to enable it.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarTom Talpey <tom@talpey.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent cb12fae1
...@@ -8,6 +8,7 @@ config NFSD ...@@ -8,6 +8,7 @@ config NFSD
select SUNRPC select SUNRPC
select EXPORTFS select EXPORTFS
select NFS_ACL_SUPPORT if NFSD_V2_ACL select NFS_ACL_SUPPORT if NFSD_V2_ACL
select NFS_ACL_SUPPORT if NFSD_V3_ACL
depends on MULTIUSER depends on MULTIUSER
help help
Choose Y here if you want to allow other computers to access Choose Y here if you want to allow other computers to access
...@@ -26,19 +27,29 @@ config NFSD ...@@ -26,19 +27,29 @@ config NFSD
Below you can choose which versions of the NFS protocol are Below you can choose which versions of the NFS protocol are
available to clients mounting the NFS server on this system. available to clients mounting the NFS server on this system.
Support for NFS version 2 (RFC 1094) is always available when Support for NFS version 3 (RFC 1813) is always available when
CONFIG_NFSD is selected. CONFIG_NFSD is selected.
If unsure, say N. If unsure, say N.
config NFSD_V2_ACL config NFSD_V2
bool bool "NFS server support for NFS version 2 (DEPRECATED)"
depends on NFSD depends on NFSD
default n
help
NFSv2 (RFC 1094) was the first publicly-released version of NFS.
Unless you are hosting ancient (1990's era) NFS clients, you don't
need this.
If unsure, say N.
config NFSD_V2_ACL
bool "NFS server support for the NFSv2 ACL protocol extension"
depends on NFSD_V2
config NFSD_V3_ACL config NFSD_V3_ACL
bool "NFS server support for the NFSv3 ACL protocol extension" bool "NFS server support for the NFSv3 ACL protocol extension"
depends on NFSD depends on NFSD
select NFSD_V2_ACL
help help
Solaris NFS servers support an auxiliary NFSv3 ACL protocol that Solaris NFS servers support an auxiliary NFSv3 ACL protocol that
never became an official part of the NFS version 3 protocol. never became an official part of the NFS version 3 protocol.
......
...@@ -10,9 +10,10 @@ obj-$(CONFIG_NFSD) += nfsd.o ...@@ -10,9 +10,10 @@ obj-$(CONFIG_NFSD) += nfsd.o
# this one should be compiled first, as the tracing macros can easily blow up # this one should be compiled first, as the tracing macros can easily blow up
nfsd-y += trace.o nfsd-y += trace.o
nfsd-y += nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \ nfsd-y += nfssvc.o nfsctl.o nfsfh.o vfs.o \
export.o auth.o lockd.o nfscache.o nfsxdr.o \ export.o auth.o lockd.o nfscache.o \
stats.o filecache.o nfs3proc.o nfs3xdr.o stats.o filecache.o nfs3proc.o nfs3xdr.o
nfsd-$(CONFIG_NFSD_V2) += nfsproc.o nfsxdr.o
nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o
nfsd-$(CONFIG_NFSD_V3_ACL) += nfs3acl.o nfsd-$(CONFIG_NFSD_V3_ACL) += nfs3acl.o
nfsd-$(CONFIG_NFSD_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4idmap.o \ nfsd-$(CONFIG_NFSD_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4idmap.o \
......
...@@ -581,7 +581,9 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) ...@@ -581,7 +581,9 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
cmd = sign == '-' ? NFSD_CLEAR : NFSD_SET; cmd = sign == '-' ? NFSD_CLEAR : NFSD_SET;
switch(num) { switch(num) {
#ifdef CONFIG_NFSD_V2
case 2: case 2:
#endif
case 3: case 3:
nfsd_vers(nn, num, cmd); nfsd_vers(nn, num, cmd);
break; break;
......
...@@ -64,8 +64,7 @@ struct readdir_cd { ...@@ -64,8 +64,7 @@ struct readdir_cd {
extern struct svc_program nfsd_program; extern struct svc_program nfsd_program;
extern const struct svc_version nfsd_version2, nfsd_version3, extern const struct svc_version nfsd_version2, nfsd_version3, nfsd_version4;
nfsd_version4;
extern struct mutex nfsd_mutex; extern struct mutex nfsd_mutex;
extern spinlock_t nfsd_drc_lock; extern spinlock_t nfsd_drc_lock;
extern unsigned long nfsd_drc_max_mem; extern unsigned long nfsd_drc_max_mem;
......
...@@ -91,8 +91,12 @@ unsigned long nfsd_drc_mem_used; ...@@ -91,8 +91,12 @@ unsigned long nfsd_drc_mem_used;
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
static struct svc_stat nfsd_acl_svcstats; static struct svc_stat nfsd_acl_svcstats;
static const struct svc_version *nfsd_acl_version[] = { static const struct svc_version *nfsd_acl_version[] = {
# if defined(CONFIG_NFSD_V2_ACL)
[2] = &nfsd_acl_version2, [2] = &nfsd_acl_version2,
# endif
# if defined(CONFIG_NFSD_V3_ACL)
[3] = &nfsd_acl_version3, [3] = &nfsd_acl_version3,
# endif
}; };
#define NFSD_ACL_MINVERS 2 #define NFSD_ACL_MINVERS 2
...@@ -116,7 +120,9 @@ static struct svc_stat nfsd_acl_svcstats = { ...@@ -116,7 +120,9 @@ static struct svc_stat nfsd_acl_svcstats = {
#endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */
static const struct svc_version *nfsd_version[] = { static const struct svc_version *nfsd_version[] = {
#if defined(CONFIG_NFSD_V2)
[2] = &nfsd_version2, [2] = &nfsd_version2,
#endif
[3] = &nfsd_version3, [3] = &nfsd_version3,
#if defined(CONFIG_NFSD_V4) #if defined(CONFIG_NFSD_V4)
[4] = &nfsd_version4, [4] = &nfsd_version4,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment