From: Salvatore Bonaccorso <carnil@debian.org>
To: Julien Leclerc <julien.leclerc@saatchi.fr>,
Jeff Layton <jlayton@kernel.org>
Cc: linux-nfs@vger.kernel.org, 1153524@bugs.debian.org,
Chuck Lever <chuck.lever@oracle.com>,
regressions@lists.linux.dev, stable@vger.kernel.org,
Chuck Lever <cel@kernel.org>,
Salvatore Bonaccorso <carnil@debian.org>
Subject: [PATCH 4/4] nfsd: fix FL_SLEEP being set unconditionally for all LOCK types
Date: Fri, 4 Dec 2026 15:20:32 +0100 [thread overview]
Message-ID: <20261204142703.1100372-5-carnil@debian.org> (raw)
In-Reply-To: <20261204142703.1100372-1-carnil@debian.org>
From: Jeff Layton <jlayton@kernel.org>
commit 246a90a5109bb2857db41f491277882ee2743b26 upstream.
The FL_SLEEP guard uses lk_type & (NFS4_READW_LT | NFS4_WRITEW_LT) which
computes lk_type & 7, non-zero for all valid lock types including
non-blocking ones. This was introduced by commit 7e64c5bc497c
("NLM/NFSD: Fix lock notifications for async-capable filesystems") when
refactoring from per-case switch arms.
Replace the bitmask test with explicit equality checks.
Fixes: 7e64c5bc497c ("NLM/NFSD: Fix lock notifications for async-capable filesystems")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260611-nfsd-testing-v2-10-5b90e276f2d9@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
---
fs/nfsd/nfs4state.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6487d9706de0..b911c08546dc 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -8398,10 +8398,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto out;
}
- if (lock->lk_type & (NFS4_READW_LT | NFS4_WRITEW_LT) &&
- nfsd4_has_session(cstate) &&
- locks_can_async_lock(nf->nf_file->f_op))
- flags |= FL_SLEEP;
+ if ((lock->lk_type == NFS4_READW_LT ||
+ lock->lk_type == NFS4_WRITEW_LT) &&
+ nfsd4_has_session(cstate) &&
+ locks_can_async_lock(nf->nf_file->f_op))
+ flags |= FL_SLEEP;
nbl = find_or_allocate_block(lock_sop, &fp->fi_fhandle, nn);
if (!nbl) {
--
2.55.0
next prev parent reply other threads:[~2026-12-04 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:20 [PATCH 6.12.y 0/4] Backport for "NLM/NFSD: Fix lock notifications for async-capable" Salvatore Bonaccorso
2026-12-04 14:20 ` [PATCH 1/4] fs: Introduce FOP_ASYNC_LOCK Salvatore Bonaccorso
2026-12-04 14:20 ` [PATCH 2/4] gfs2/ocfs2: set FOP_ASYNC_LOCK Salvatore Bonaccorso
2026-12-04 14:20 ` [PATCH 3/4] NLM/NFSD: Fix lock notifications for async-capable filesystems Salvatore Bonaccorso
2026-12-04 14:20 ` Salvatore Bonaccorso [this message]
2026-12-04 14:37 ` [PATCH 6.12.y 0/4] Backport for "NLM/NFSD: Fix lock notifications for async-capable" Jeff Layton
2026-12-04 19:49 ` Sasha Levin
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=20261204142703.1100372-5-carnil@debian.org \
--to=carnil@debian.org \
--cc=1153524@bugs.debian.org \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=julien.leclerc@saatchi.fr \
--cc=linux-nfs@vger.kernel.org \
--cc=regressions@lists.linux.dev \
--cc=stable@vger.kernel.org \
/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