linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0
@ 2018-08-10 20:44 Scott Mayhew
  2018-08-10 20:44 ` [nfs-utils PATCH 1/2] nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf Scott Mayhew
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Scott Mayhew @ 2018-08-10 20:44 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

The first patch allows version 4.0 to be enabled/disabled via the
nfs.conf file.

The second patch adds a variable to track when the user explicitly
requested version 4.0 to be enabled/disabled so that '+4.0' or '-4.0'
can be written to /proc/fs/nfsd/versions on 4.11 (first appearance of
commit d3635ff07e8c "nfsd: fix configuration of supported minor
versions").

Note that if version 4.0 is disabled (either via '-N4.0' on the command
line or via 'vers4.0=n' in nfs.conf), then it must be re-enabled
explicitly (either via '-V4.0' on the command line or via 'vers4.0=y' in
nfs.conf).  Simply removing the '-N4.0'/'vers4.0=n' options and/or
replacing them with '-V4/vers4=y' is not sufficient.  It is my
understanding that that is the desired behavior.

Scott Mayhew (2):
  nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf
  nfsd: track when the user explicitly requested version 4.0

 utils/nfsd/nfsd.c   | 17 +++++++++++------
 utils/nfsd/nfssvc.c | 14 +++++++++-----
 utils/nfsd/nfssvc.h |  3 ++-
 3 files changed, 22 insertions(+), 12 deletions(-)

-- 
2.14.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [nfs-utils PATCH 1/2] nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf
  2018-08-10 20:44 [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Scott Mayhew
@ 2018-08-10 20:44 ` Scott Mayhew
  2018-08-10 20:44 ` [nfs-utils PATCH 2/2] nfsd: track when the user explicitly requested version 4.0 Scott Mayhew
  2018-08-20 13:00 ` [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Steve Dickson
  2 siblings, 0 replies; 4+ messages in thread
From: Scott Mayhew @ 2018-08-10 20:44 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

The nfs.conf file has a 'vers4.0' parameter, but nfsd doesn't currently
check it.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 utils/nfsd/nfsd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index f048631..bd86d11 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -110,11 +110,7 @@ main(int argc, char **argv)
 	/* We assume the kernel will default all minor versions to 'on',
 	 * and allow the config file to disable some.
 	 */
-	if (NFSCTL_VERISSET(versbits, 4)) {
-		NFSCTL_MINORSET(minorversset, 0);
-		NFSCTL_MINORSET(minorvers, 0);
-	}
-	for (i = 1; i <= NFS4_MAXMINOR; i++) {
+	for (i = NFS4_MINMINOR; i <= NFS4_MAXMINOR; i++) {
 		char tag[20];
 		sprintf(tag, "vers4.%d", i);
 		/* The default for minor version support is to let the
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [nfs-utils PATCH 2/2] nfsd: track when the user explicitly requested version 4.0
  2018-08-10 20:44 [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Scott Mayhew
  2018-08-10 20:44 ` [nfs-utils PATCH 1/2] nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf Scott Mayhew
@ 2018-08-10 20:44 ` Scott Mayhew
  2018-08-20 13:00 ` [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Steve Dickson
  2 siblings, 0 replies; 4+ messages in thread
From: Scott Mayhew @ 2018-08-10 20:44 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Since both 'rpc.nfsd -V4' and 'rpc.nfsd -V4.0' alter bit 0 in 'minorversset'
and 'minorvers', it's not possible to know whether the user explicitly
requested version 4.0 or not.  Add another variable 'force4dot0' to track
when the user explicitly requested version 4.0 so that we can write '4.0'
to /proc/fs/nfsd/versions on kernel versions 4.11 and higher.  On earlier
kernels, we'll still write '4' as in the past.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 utils/nfsd/nfsd.c   | 11 ++++++++++-
 utils/nfsd/nfssvc.c | 14 +++++++++-----
 utils/nfsd/nfssvc.h |  3 ++-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index bd86d11..6b57e2b 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -72,6 +72,7 @@ main(int argc, char **argv)
 	unsigned int protobits = NFSCTL_PROTODEFAULT;
 	int grace = -1;
 	int lease = -1;
+	int force4dot0 = 0;
 
 	progname = basename(argv[0]);
 	haddr = xmalloc(sizeof(char *));
@@ -124,10 +125,14 @@ main(int argc, char **argv)
 		if (!conf_get_bool("nfsd", tag, 1)) {
 			NFSCTL_MINORSET(minorversset, i);
 			NFSCTL_MINORUNSET(minorvers, i);
+			if (i == 0)
+				force4dot0 = 1;
 		}
 		if (conf_get_bool("nfsd", tag, 0)) {
 			NFSCTL_MINORSET(minorversset, i);
 			NFSCTL_MINORSET(minorvers, i);
+			if (i == 0)
+				force4dot0 = 1;
 		}
 	}
 
@@ -188,6 +193,8 @@ main(int argc, char **argv)
 					}
 					NFSCTL_MINORSET(minorversset, i);
 					NFSCTL_MINORUNSET(minorvers, i);
+					if (i == 0)
+						force4dot0 = 1;
 					if (minorvers != 0)
 						break;
 				} else {
@@ -215,6 +222,8 @@ main(int argc, char **argv)
 					}
 					NFSCTL_MINORSET(minorversset, i);
 					NFSCTL_MINORSET(minorvers, i);
+					if (i == 0)
+						force4dot0 = 1;
 				} else
 					minorvers = minorversset = minormask;
 				/* FALLTHRU */
@@ -331,7 +340,7 @@ main(int argc, char **argv)
 	 * Timeouts must also be set before ports are created else we get
 	 * EBUSY.
 	 */
-	nfssvc_setvers(versbits, minorvers, minorversset);
+	nfssvc_setvers(versbits, minorvers, minorversset, force4dot0);
 	if (grace > 0)
 		nfssvc_set_time("grace", grace);
 	if (lease  > 0)
diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index 7923f5d..1e6ffd6 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -25,6 +25,7 @@
 #include "nfslib.h"
 #include "xlog.h"
 #include "nfssvc.h"
+#include "../mount/version.h"
 
 #ifndef NFSD_FS_DIR
 #define NFSD_FS_DIR	  "/proc/fs/nfsd"
@@ -369,16 +370,18 @@ out:
 
 static int
 nfssvc_print_vers(char *ptr, unsigned size, unsigned vers, unsigned minorvers,
-		int isset)
+		int isset, int force4dot0)
 {
 	char sign = isset ? '+' : '-';
 	if (minorvers == 0)
-		return snprintf(ptr, size, "%c%u ", sign, vers);
+		if (linux_version_code() < MAKE_VERSION(4, 11, 0) || !force4dot0)
+			return snprintf(ptr, size, "%c%u ", sign, vers);
 	return snprintf(ptr, size, "%c%u.%u ", sign, vers, minorvers);
 }
 
 void
-nfssvc_setvers(unsigned int ctlbits, unsigned int minorvers, unsigned int minorversset)
+nfssvc_setvers(unsigned int ctlbits, unsigned int minorvers, unsigned int minorversset,
+	       int force4dot0)
 {
 	int fd, n, off;
 
@@ -389,13 +392,14 @@ nfssvc_setvers(unsigned int ctlbits, unsigned int minorvers, unsigned int minorv
 
 	for (n = NFSD_MINVERS; n <= ((NFSD_MAXVERS < 3) ? NFSD_MAXVERS : 3); n++)
 		off += nfssvc_print_vers(&buf[off], sizeof(buf) - off,
-				n, 0, NFSCTL_VERISSET(ctlbits, n));
+				n, 0, NFSCTL_VERISSET(ctlbits, n), 0);
 
 	for (n = 0; n <= NFS4_MAXMINOR; n++) {
 		if (!NFSCTL_MINORISSET(minorversset, n))
 			continue;
 		off += nfssvc_print_vers(&buf[off], sizeof(buf) - off,
-				4, n, NFSCTL_MINORISSET(minorvers, n));
+				4, n, NFSCTL_MINORISSET(minorvers, n),
+				(n == 0) ? force4dot0 : 0);
 	}
 	if (!off--)
 		goto out;
diff --git a/utils/nfsd/nfssvc.h b/utils/nfsd/nfssvc.h
index 39ebf37..4d53af1 100644
--- a/utils/nfsd/nfssvc.h
+++ b/utils/nfsd/nfssvc.h
@@ -26,6 +26,7 @@ int	nfssvc_set_sockets(const unsigned int protobits,
 			   const char *host, const char *port);
 void	nfssvc_set_time(const char *type, const int seconds);
 int	nfssvc_set_rdmaport(const char *port);
-void	nfssvc_setvers(unsigned int ctlbits, unsigned int minorvers4, unsigned int minorvers4set);
+void	nfssvc_setvers(unsigned int ctlbits, unsigned int minorvers4,
+		       unsigned int minorvers4set, int force4dot0);
 int	nfssvc_threads(int nrservs);
 void	nfssvc_get_minormask(unsigned int *mask);
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0
  2018-08-10 20:44 [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Scott Mayhew
  2018-08-10 20:44 ` [nfs-utils PATCH 1/2] nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf Scott Mayhew
  2018-08-10 20:44 ` [nfs-utils PATCH 2/2] nfsd: track when the user explicitly requested version 4.0 Scott Mayhew
@ 2018-08-20 13:00 ` Steve Dickson
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2018-08-20 13:00 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: linux-nfs



On 08/10/2018 04:44 PM, Scott Mayhew wrote:
> The first patch allows version 4.0 to be enabled/disabled via the
> nfs.conf file.
> 
> The second patch adds a variable to track when the user explicitly
> requested version 4.0 to be enabled/disabled so that '+4.0' or '-4.0'
> can be written to /proc/fs/nfsd/versions on 4.11 (first appearance of
> commit d3635ff07e8c "nfsd: fix configuration of supported minor
> versions").
> 
> Note that if version 4.0 is disabled (either via '-N4.0' on the command
> line or via 'vers4.0=n' in nfs.conf), then it must be re-enabled
> explicitly (either via '-V4.0' on the command line or via 'vers4.0=y' in
> nfs.conf).  Simply removing the '-N4.0'/'vers4.0=n' options and/or
> replacing them with '-V4/vers4=y' is not sufficient.  It is my
> understanding that that is the desired behavior.
> 
> Scott Mayhew (2):
>   nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf
>   nfsd: track when the user explicitly requested version 4.0
> 
>  utils/nfsd/nfsd.c   | 17 +++++++++++------
>  utils/nfsd/nfssvc.c | 14 +++++++++-----
>  utils/nfsd/nfssvc.h |  3 ++-
>  3 files changed, 22 insertions(+), 12 deletions(-)
> 
Committed both patch... Nice work!! Thank you!!!

steved.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-20 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-10 20:44 [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Scott Mayhew
2018-08-10 20:44 ` [nfs-utils PATCH 1/2] nfsd: allow verson 4.0 to be enabled/disabled via nfs.conf Scott Mayhew
2018-08-10 20:44 ` [nfs-utils PATCH 2/2] nfsd: track when the user explicitly requested version 4.0 Scott Mayhew
2018-08-20 13:00 ` [nfs-utils PATCH 0/2] A few fixes to rpc.nfsd enabling/disabling minor version 0 Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).