All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs.conf: fail to disable major NFS version 4 using "vers4=n" in /etc/nfs.conf
@ 2018-09-26 14:42 Steve Dickson
  0 siblings, 0 replies; only message in thread
From: Steve Dickson @ 2018-09-26 14:42 UTC (permalink / raw)
  To: Linux NFS Mailing list

From: Justin Mitchell <jumitche@redhat.com>

Setting "vers4=n/off" (disabling the major NFS version 4) in nfs.conf
doesn't work now.

Refer to rpc.nfsd(8), "vers3/vers4" in the [nfsd] section of the
/etc/nfs.conf file is to enable or disable a major NFS version 3 or 4
(which are normally enabled by default).

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1625032

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/nfsd/nfsd.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 6b57e2b..b256bd9 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -83,6 +83,9 @@ main(int argc, char **argv)
 
 	conf_init_file(NFS_CONFFILE); 
 	xlog_from_conffile("nfsd");
+
+	nfssvc_get_minormask(&minormask);
+
 	count = conf_get_num("nfsd", "threads", count);
 	grace = conf_get_num("nfsd", "grace-time", grace);
 	lease = conf_get_num("nfsd", "lease-time", lease);
@@ -101,13 +104,19 @@ main(int argc, char **argv)
 	for (i = 2; i <= 4; i++) {
 		char tag[20];
 		sprintf(tag, "vers%d", i);
-		if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i)))
+		if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i))) {
 			NFSCTL_VERSET(versbits, i);
-		else
+			if (i == 4)
+				minorvers = minorversset = minormask;
+		} else {
 			NFSCTL_VERUNSET(versbits, i);
+			if (i == 4) {
+				minorvers = 0;
+				minorversset = minormask;
+			}
+		}
 	}
 
-	nfssvc_get_minormask(&minormask);
 	/* We assume the kernel will default all minor versions to 'on',
 	 * and allow the config file to disable some.
 	 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-26 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 14:42 [PATCH] nfs.conf: fail to disable major NFS version 4 using "vers4=n" in /etc/nfs.conf Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.