All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "NFSD: fix nfsd_reset_versions for NFSv4." has been added to the 4.9-stable tree
@ 2017-12-18 13:22 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-12-18 13:22 UTC (permalink / raw)
  To: neilb, alexander.levin, bfields, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    NFSD: fix nfsd_reset_versions for NFSv4.

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nfsd-fix-nfsd_reset_versions-for-nfsv4.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Mon Dec 18 14:12:34 CET 2017
From: NeilBrown <neilb@suse.com>
Date: Fri, 10 Mar 2017 11:36:39 +1100
Subject: NFSD: fix nfsd_reset_versions for NFSv4.

From: NeilBrown <neilb@suse.com>


[ Upstream commit 800a938f0bf9130c8256116649c0cc5806bfb2fd ]

If you write "-2 -3 -4" to the "versions" file, it will
notice that no versions are enabled, and nfsd_reset_versions()
is called.
This enables all major versions, not no minor versions.
So we lose the invariant that NFSv4 is only advertised when
at least one minor is enabled.

Fix the code to explicitly enable minor versions for v4,
change it to use nfsd_vers() to test and set, and simplify
the code.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfsd/nfssvc.c |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -400,23 +400,20 @@ static void nfsd_last_thread(struct svc_
 
 void nfsd_reset_versions(void)
 {
-	int found_one = 0;
 	int i;
 
-	for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) {
-		if (nfsd_program.pg_vers[i])
-			found_one = 1;
-	}
+	for (i = 0; i < NFSD_NRVERS; i++)
+		if (nfsd_vers(i, NFSD_TEST))
+			return;
 
-	if (!found_one) {
-		for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++)
-			nfsd_program.pg_vers[i] = nfsd_version[i];
-#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
-		for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++)
-			nfsd_acl_program.pg_vers[i] =
-				nfsd_acl_version[i];
-#endif
-	}
+	for (i = 0; i < NFSD_NRVERS; i++)
+		if (i != 4)
+			nfsd_vers(i, NFSD_SET);
+		else {
+			int minor = 0;
+			while (nfsd_minorversion(minor, NFSD_SET) >= 0)
+				minor++;
+		}
 }
 
 /*


Patches currently in stable-queue which might be from neilb@suse.com are

queue-4.9/md-cluster-free-md_cluster_info-if-node-leave-cluster.patch
queue-4.9/autofs-fix-careless-error-in-recent-commit.patch
queue-4.9/raid5-set-r5_expanded-on-parity-devices-as-well-as-data.patch
queue-4.9/nfsd-fix-nfsd_reset_versions-for-nfsv4.patch
queue-4.9/nfsd-fix-nfsd_minorversion-..-nfsd_avail.patch

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

only message in thread, other threads:[~2017-12-18 13:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18 13:22 Patch "NFSD: fix nfsd_reset_versions for NFSv4." has been added to the 4.9-stable tree gregkh

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.