diff options
| author | Jeff Layton <jlayton@kernel.org> | 2026-06-11 16:00:56 -0400 |
|---|---|---|
| committer | Chuck Lever <cel@kernel.org> | 2026-07-05 21:07:22 -0400 |
| commit | b4b950a3f23cebd9d9655ec990db221d19ed5c90 (patch) | |
| tree | c649fd53fd9048eb9cbdcf7a82f2b653051ae4e4 | |
| parent | 59586c9e2f011e9cc28da30f3f682be7086a3f21 (diff) | |
| download | linux-next-b4b950a3f23cebd9d9655ec990db221d19ed5c90.tar.gz linux-next-b4b950a3f23cebd9d9655ec990db221d19ed5c90.zip | |
nfsd: use test_and_clear_bit for somebody_reclaimed to prevent lost update
clients_still_reclaiming() uses separate test_bit() and clear_bit()
calls on NFSD_NET_SOMEBODY_RECLAIMED. A concurrent set_bit() from
the OPEN or LOCK reclaim path arriving between the test and clear
is silently lost, causing the next laundromat tick to end grace
prematurely.
Replace with test_and_clear_bit() to make the read-and-clear atomic.
Fixes: 8c67a210c90c ("nfsd: convert nfsd_net boolean flags to unsigned long flags word")
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-13-5b90e276f2d9@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
| -rw-r--r-- | fs/nfsd/nfs4state.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 17cb3b0ad956..0735a3bafa58 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6884,9 +6884,8 @@ static bool clients_still_reclaiming(struct nfsd_net *nn) if (atomic_read(&nn->nr_reclaim_complete) == size) return false; } - if (!test_bit(NFSD_NET_SOMEBODY_RECLAIMED, &nn->flags)) + if (!test_and_clear_bit(NFSD_NET_SOMEBODY_RECLAIMED, &nn->flags)) return false; - clear_bit(NFSD_NET_SOMEBODY_RECLAIMED, &nn->flags); /* * If we've given them *two* lease times to reclaim, and they're * still not done, give up: |
