From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>, Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: <linux-nfs@vger.kernel.org>, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v2 2/2] NFSD: WARN if fi_fds[O_RDONLY] is already populated
Date: Tue, 2 Dec 2025 17:42:08 -0500 [thread overview]
Message-ID: <20251202224208.4449-2-cel@kernel.org> (raw)
In-Reply-To: <20251202224208.4449-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
nfsd4_add_rdaccess_to_wrdeleg() expects that fi_fds[O_RDONLY] is
NULL. If it's not NULL, there's a software bug somewhere else that
needs to be looked into.
Replace the redundant fp assignment with a WARN_ON_ONCE.
Suggested-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfsd/nfs4state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1c9802d06de1..b8fd0ed3fd53 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6236,7 +6236,7 @@ nfsd4_add_rdaccess_to_wrdeleg(struct svc_rqst *rqstp, struct nfsd4_open *open,
fp = stp->st_stid.sc_file;
spin_lock(&fp->fi_lock);
__nfs4_file_get_access(fp, NFS4_SHARE_ACCESS_READ);
- fp = stp->st_stid.sc_file;
+ WARN_ON_ONCE(fp->fi_fds[O_RDONLY] != NULL);
fp->fi_fds[O_RDONLY] = nf;
fp->fi_rdeleg_file = nf;
spin_unlock(&fp->fi_lock);
--
2.52.0
next prev parent reply other threads:[~2025-12-02 22:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 22:42 [PATCH v2 1/2] nfsd: prevent write delegations when client has existing opens Chuck Lever
2025-12-02 22:42 ` Chuck Lever [this message]
2025-12-03 12:28 ` [PATCH v2 2/2] NFSD: WARN if fi_fds[O_RDONLY] is already populated Jeff Layton
2025-12-02 23:28 ` [PATCH v2 1/2] nfsd: prevent write delegations when client has existing opens NeilBrown
2025-12-03 1:43 ` Chuck Lever
2025-12-03 2:31 ` NeilBrown
2025-12-03 12:26 ` Jeff Layton
2025-12-03 14:54 ` Chuck Lever
2025-12-03 14:56 ` Jeff Layton
2025-12-03 22:45 ` NeilBrown
2025-12-04 1:06 ` 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=20251202224208.4449-2-cel@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).