Skip to content

Commit

Permalink
nfsd: extra checks when freeing delegation stateids
Browse files Browse the repository at this point in the history
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 <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Jeff Layton authored and Chuck Lever committed Sep 26, 2022
1 parent b95239c commit 895ddf5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,12 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp)

static void nfs4_free_deleg(struct nfs4_stid *stid)
{
WARN_ON(!list_empty(&stid->sc_cp_list));
struct nfs4_delegation *dp = delegstateid(stid);

WARN_ON_ONCE(!list_empty(&stid->sc_cp_list));
WARN_ON_ONCE(!list_empty(&dp->dl_perfile));
WARN_ON_ONCE(!list_empty(&dp->dl_perclnt));
WARN_ON_ONCE(!list_empty(&dp->dl_recall_lru));
kmem_cache_free(deleg_slab, stid);
atomic_long_dec(&num_delegations);
}
Expand Down

0 comments on commit 895ddf5

Please sign in to comment.