Skip to content

Commit 895ddf5

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: extra checks when freeing delegation stateids
We've had some reports of problems in the refcounting for delegation stateids that we've yet to track down. Add some extra checks to ensure that we've removed the object from various lists before freeing it. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2127067 Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent b95239c commit 895ddf5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/nfsd/nfs4state.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,12 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp)
10601060

10611061
static void nfs4_free_deleg(struct nfs4_stid *stid)
10621062
{
1063-
WARN_ON(!list_empty(&stid->sc_cp_list));
1063+
struct nfs4_delegation *dp = delegstateid(stid);
1064+
1065+
WARN_ON_ONCE(!list_empty(&stid->sc_cp_list));
1066+
WARN_ON_ONCE(!list_empty(&dp->dl_perfile));
1067+
WARN_ON_ONCE(!list_empty(&dp->dl_perclnt));
1068+
WARN_ON_ONCE(!list_empty(&dp->dl_recall_lru));
10641069
kmem_cache_free(deleg_slab, stid);
10651070
atomic_long_dec(&num_delegations);
10661071
}

0 commit comments

Comments
 (0)