diff mbox series

[1/1] nfsd: adjust WARN_ON_ONCE in revoke_delegation

Message ID 20250123193831.87330-1-okorniev@redhat.com (mailing list archive)
State Under Review
Delegated to: Chuck Lever
Headers show
Series [1/1] nfsd: adjust WARN_ON_ONCE in revoke_delegation | expand

Commit Message

Olga Kornievskaia Jan. 23, 2025, 7:38 p.m. UTC
A WARN_ON_ONCE() is added to revoke delegations to make sure that the
state has been marked for revocation. However, that's only true for 4.1+
stateids. For 4.0 stateids, in unhash_delegation_locked() the sc_status
is set to SC_STATUS_CLOSED. Modify the check to reflect it, otherwise
a WARN_ON_ONCE is erronously triggered.

Fixes: 8dd91e8d31fe ("nfsd: fix race between laundromat and free_stateid")
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
---
 fs/nfsd/nfs4state.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chuck Lever Jan. 24, 2025, 2:15 p.m. UTC | #1
From: Chuck Lever <chuck.lever@oracle.com>

On Thu, 23 Jan 2025 14:38:31 -0500, Olga Kornievskaia wrote:
> A WARN_ON_ONCE() is added to revoke delegations to make sure that the
> state has been marked for revocation. However, that's only true for 4.1+
> stateids. For 4.0 stateids, in unhash_delegation_locked() the sc_status
> is set to SC_STATUS_CLOSED. Modify the check to reflect it, otherwise
> a WARN_ON_ONCE is erronously triggered.
> 
> 
> [...]

Applied to nfsd-testing, thanks!

[1/1] nfsd: adjust WARN_ON_ONCE in revoke_delegation
      commit: 82956213af9f2e299bf5842d80c9640c55b42c98

--
Chuck Lever
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b7a0cfd05401..d2d3feba36cd 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1378,7 +1378,8 @@  static void revoke_delegation(struct nfs4_delegation *dp)
 	struct nfs4_client *clp = dp->dl_stid.sc_client;
 
 	WARN_ON(!list_empty(&dp->dl_recall_lru));
-	WARN_ON_ONCE(!(dp->dl_stid.sc_status &
+	WARN_ON_ONCE(dp->dl_stid.sc_client->cl_minorversion > 0 &&
+		     !(dp->dl_stid.sc_status &
 		     (SC_STATUS_REVOKED | SC_STATUS_ADMIN_REVOKED)));
 
 	trace_nfsd_stid_revoke(&dp->dl_stid);