nfsd: adjust WARN_ON_ONCE in revoke_delegation
authorOlga Kornievskaia <okorniev@redhat.com>
Thu, 23 Jan 2025 19:38:31 +0000 (14:38 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Mar 2025 13:10:55 +0000 (09:10 -0400)
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.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c

index 153eeea2c7c999d003cd1f36cecb0dd4f6e049b8..cb6baff8abf847becd3c62c4be501b4faf514e1a 100644 (file)
@@ -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);