diff options
author | J. Bruce Fields <bfields@redhat.com> | 2018-02-15 23:29:15 +0300 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2018-03-21 00:51:10 +0300 |
commit | b8232d3315ec746e3b5d4c9252541567e57a509b (patch) | |
tree | 0c77d08d40df7720311225bf90df3d769b859263 /fs/nfsd | |
parent | 6f29d07ca4b999c36d42f9cf8d1dddf9ddca3250 (diff) | |
download | linux-b8232d3315ec746e3b5d4c9252541567e57a509b.tar.xz |
nfsd: simplify put of fi_deleg_file
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>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 16efbe2b1853..9072d0f8340b 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -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) { |