Skip to content

Commit

Permalink
nfsd: simplify put of fi_deleg_file
Browse files Browse the repository at this point in the history
fi_delegees is basically just a reference count on users of
fi_deleg_file, which is cleared when fi_delegees goes to zero.  The
fi_deleg_file check here is redundant.  Also add an assertion to make
sure we don't have unbalanced puts.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
  • Loading branch information
J. Bruce Fields committed Mar 20, 2018
1 parent 6f29d07 commit b8232d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,12 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
{
struct file *filp = NULL;

WARN_ON_ONCE(!fp->fi_delegees);

spin_lock(&fp->fi_lock);
if (fp->fi_deleg_file && --fp->fi_delegees == 0)
if (--fp->fi_delegees == 0) {
swap(filp, fp->fi_deleg_file);
}
spin_unlock(&fp->fi_lock);

if (filp) {
Expand Down

0 comments on commit b8232d3

Please sign in to comment.