From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Shuah Khan <shuah@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH v2 1/8] nfsd: clear NFSD_NET_UP before dropping the generic resource reference
Date: Tue, 22 Sep 2026 07:34:02 -0400 [thread overview]
Message-ID: <20260922-nfsd-per-net-mutex-v2-1-4a5da8243a73@kernel.org> (raw)
In-Reply-To: <20260922-nfsd-per-net-mutex-v2-0-4a5da8243a73@kernel.org>
nfsd_shutdown_net() leaves NFSD_NET_UP set across nfsd_shutdown_generic(),
so during that window the bit claims the host-wide file cache and NFSv4
tables are up when the last namespace may already have torn them down.
Nothing observes it today only because one global mutex covers both.
Fold the test and clear into test_and_clear_bit() so the invariant
"NFSD_NET_UP implies the generic resources are up" holds on its own.
No functional change.
Assisted-by: LLM
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/nfssvc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index cbc989238710..d75fe1523436 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -433,9 +433,13 @@ static void nfsd_shutdown_net(struct net *net)
percpu_ref_exit(&nn->nfsd_net_ref);
- if (test_bit(NFSD_NET_UP, &nn->flags))
+ /*
+ * Clear NFSD_NET_UP before dropping this namespace's reference on
+ * the generic (host-wide) resources, so that the bit never claims
+ * they are available once they may already be gone.
+ */
+ if (test_and_clear_bit(NFSD_NET_UP, &nn->flags))
nfsd_shutdown_generic();
- clear_bit(NFSD_NET_UP, &nn->flags);
}
static DEFINE_SPINLOCK(nfsd_notifier_lock);
--
2.55.0
next prev parent reply other threads:[~2026-09-22 11:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 11:34 [PATCH v2 0/8] nfsd: reduce the scope of the nfsd_mutex Jeff Layton
2026-09-22 11:34 ` Jeff Layton [this message]
2026-09-22 11:34 ` [PATCH v2 2/8] nfsd: make max_blksize a per-namespace setting Jeff Layton
2026-09-22 11:34 ` [PATCH v2 3/8] nfsd: move the control plane to a per-namespace mutex Jeff Layton
2026-09-22 11:34 ` [PATCH v2 4/8] nfsd: rename nfsd_mutex to nfsd_global_mutex Jeff Layton
2026-09-22 11:34 ` [PATCH v2 5/8] nfsd: give the open file cache its own mutex Jeff Layton
2026-09-22 11:34 ` [PATCH v2 6/8] selftests/nfsd: factor the netlink plumbing into a shared header Jeff Layton
2026-09-22 11:34 ` [PATCH v2 7/8] selftests/nfsd: add cross-namespace isolation tests Jeff Layton
2026-09-22 11:34 ` [PATCH v2 8/8] selftests/nfsd: add a cross-namespace control-plane soak Jeff Layton
2026-09-22 15:50 ` [PATCH v2 0/8] nfsd: reduce the scope of the nfsd_mutex Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260922-nfsd-per-net-mutex-v2-1-4a5da8243a73@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=cel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=shuah@kernel.org \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®