Re: [PATCH v2 2/2] nfsd: allow disabling NFSv2 at compile time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Oct 17, 2022, at 4:14 PM, Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> 
> 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.

This works for me. I'll wait for more comments, but I plan
to pull this into for-next soon.


> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
> fs/nfsd/Kconfig  | 19 +++++++++++++++----
> fs/nfsd/Makefile |  5 +++--
> fs/nfsd/nfsd.h   |  3 +--
> fs/nfsd/nfssvc.c |  6 ++++++
> 4 files changed, 25 insertions(+), 8 deletions(-)
> 
> v2: split out nfserrno move into separate patch
>    add help text to CONFIG_NFSD_V2 Kconfig option
>    don't error out in __write_versions
> 
> diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
> index f6a2fd3015e7..7c441f2bd444 100644
> --- a/fs/nfsd/Kconfig
> +++ b/fs/nfsd/Kconfig
> @@ -8,6 +8,7 @@ config NFSD
> 	select SUNRPC
> 	select EXPORTFS
> 	select NFS_ACL_SUPPORT if NFSD_V2_ACL
> +	select NFS_ACL_SUPPORT if NFSD_V3_ACL
> 	depends on MULTIUSER
> 	help
> 	  Choose Y here if you want to allow other computers to access
> @@ -26,19 +27,29 @@ config NFSD
> 
> 	  Below you can choose which versions of the NFS protocol are
> 	  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.
> 
> 	  If unsure, say N.
> 
> -config NFSD_V2_ACL
> -	bool
> +config NFSD_V2
> +	bool "NFS server support for NFS version 2 (DEPRECATED)"
> 	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
> 	bool "NFS server support for the NFSv3 ACL protocol extension"
> 	depends on NFSD
> -	select NFSD_V2_ACL
> 	help
> 	  Solaris NFS servers support an auxiliary NFSv3 ACL protocol that
> 	  never became an official part of the NFS version 3 protocol.
> diff --git a/fs/nfsd/Makefile b/fs/nfsd/Makefile
> index 805c06d5f1b4..6fffc8f03f74 100644
> --- a/fs/nfsd/Makefile
> +++ b/fs/nfsd/Makefile
> @@ -10,9 +10,10 @@ obj-$(CONFIG_NFSD)	+= nfsd.o
> # this one should be compiled first, as the tracing macros can easily blow up
> nfsd-y			+= trace.o
> 
> -nfsd-y 			+= nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
> -			   export.o auth.o lockd.o nfscache.o nfsxdr.o \
> +nfsd-y 			+= nfssvc.o nfsctl.o nfsfh.o vfs.o \
> +			   export.o auth.o lockd.o nfscache.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_V3_ACL) += nfs3acl.o
> nfsd-$(CONFIG_NFSD_V4)	+= nfs4proc.o nfs4xdr.o nfs4state.o nfs4idmap.o \
> diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> index 09726c5b9a31..93b42ef9ed91 100644
> --- a/fs/nfsd/nfsd.h
> +++ b/fs/nfsd/nfsd.h
> @@ -64,8 +64,7 @@ struct readdir_cd {
> 
> 
> extern struct svc_program	nfsd_program;
> -extern const struct svc_version	nfsd_version2, nfsd_version3,
> -				nfsd_version4;
> +extern const struct svc_version	nfsd_version2, nfsd_version3, nfsd_version4;
> extern struct mutex		nfsd_mutex;
> extern spinlock_t		nfsd_drc_lock;
> extern unsigned long		nfsd_drc_max_mem;
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index bfbd9f672f59..62e473b0ca52 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -91,8 +91,12 @@ unsigned long	nfsd_drc_mem_used;
> #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
> static struct svc_stat	nfsd_acl_svcstats;
> static const struct svc_version *nfsd_acl_version[] = {
> +# if defined(CONFIG_NFSD_V2_ACL)
> 	[2] = &nfsd_acl_version2,
> +# endif
> +# if defined(CONFIG_NFSD_V3_ACL)
> 	[3] = &nfsd_acl_version3,
> +# endif
> };
> 
> #define NFSD_ACL_MINVERS            2
> @@ -116,7 +120,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
> 	[3] = &nfsd_version3,
> #if defined(CONFIG_NFSD_V4)
> 	[4] = &nfsd_version4,
> -- 
> 2.37.3
> 

--
Chuck Lever







[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux