Commit 4e026935 authored by Anna Schumaker's avatar Anna Schumaker
Browse files

NFS: Add a way to disable NFS v4.0 via KConfig



I introduce NFS4_MIN_MINOR_VERSION as a parallel to
NFS4_MAX_MINOR_VERSION to check if NFS v4.0 has been compiled in and
return an appropriate error if not.

Signed-off-by: default avatarAnna Schumaker <anna.schumaker@oracle.com>
parent 9c54afc1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -96,6 +96,15 @@ config NFS_SWAP
	help
	  This option enables swapon to work on files located on NFS mounts.

config NFS_V4_0
	bool "NFS client support for NFSv4.0"
	depends on NFS_V4
	help
	  This option enables support for minor version 0 of the NFSv4 protocol
	  (RFC 3530) in the kernel's NFS client.

	  If unsure, say N.

config NFS_V4_1
	bool "NFS client support for NFSv4.1"
	depends on NFS_V4
+2 −1
Original line number Diff line number Diff line
@@ -27,9 +27,10 @@ CFLAGS_nfs4trace.o += -I$(src)
nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
	  delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
	  nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
	  dns_resolve.o nfs4trace.o nfs40proc.o nfs40client.o
	  dns_resolve.o nfs4trace.o
nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
nfsv4-$(CONFIG_SYSCTL)	+= nfs4sysctl.o
nfsv4-$(CONFIG_NFS_V4_0)	+= nfs40client.o nfs40proc.o
nfsv4-$(CONFIG_NFS_V4_1)	+= pnfs.o pnfs_dev.o pnfs_nfs.o
nfsv4-$(CONFIG_NFS_V4_2)	+= nfs42proc.o nfs42xattr.o

+2 −1
Original line number Diff line number Diff line
@@ -806,7 +806,8 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
		ctx->mount_server.version = result.uint_32;
		break;
	case Opt_minorversion:
		if (result.uint_32 > NFS4_MAX_MINOR_VERSION)
		if (result.uint_32 < NFS4_MIN_MINOR_VERSION ||
		    result.uint_32 > NFS4_MAX_MINOR_VERSION)
			goto out_of_bounds;
		ctx->minorversion = result.uint_32;
		break;
+6 −0
Original line number Diff line number Diff line
@@ -10,6 +10,12 @@
#ifndef __LINUX_FS_NFS_NFS4_FS_H
#define __LINUX_FS_NFS_NFS4_FS_H

#if defined(CONFIG_NFS_V4_0)
#define NFS4_MIN_MINOR_VERSION 0
#else
#define NFS4_MIN_MINOR_VERSION 1
#endif

#if defined(CONFIG_NFS_V4_2)
#define NFS4_MAX_MINOR_VERSION 2
#elif defined(CONFIG_NFS_V4_1)
+2 −1
Original line number Diff line number Diff line
@@ -203,7 +203,8 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
	if (err)
		goto error;

	if (cl_init->minorversion > NFS4_MAX_MINOR_VERSION) {
	if (cl_init->minorversion < NFS4_MIN_MINOR_VERSION ||
	    cl_init->minorversion > NFS4_MAX_MINOR_VERSION) {
		err = -EINVAL;
		goto error;
	}
Loading