Commit 99939792 authored by Trond Myklebust's avatar Trond Myklebust Committed by Chuck Lever

nfsd: Clean up nfsd_file_put()

Make it a little less racy, by removing the refcount_read() test. Then
remove the redundant 'is_hashed' variable.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 6b8a9433
......@@ -301,20 +301,13 @@ nfsd_file_put_noref(struct nfsd_file *nf)
void
nfsd_file_put(struct nfsd_file *nf)
{
bool is_hashed;
set_bit(NFSD_FILE_REFERENCED, &nf->nf_flags);
if (refcount_read(&nf->nf_ref) > 2 || !nf->nf_file) {
nfsd_file_put_noref(nf);
return;
}
is_hashed = test_bit(NFSD_FILE_HASHED, &nf->nf_flags) != 0;
if (!is_hashed) {
if (test_bit(NFSD_FILE_HASHED, &nf->nf_flags) == 0) {
nfsd_file_flush(nf);
nfsd_file_put_noref(nf);
} else {
nfsd_file_put_noref(nf);
if (nf->nf_file)
nfsd_file_schedule_laundrette();
}
if (atomic_long_read(&nfsd_filecache_count) >= NFSD_FILE_LRU_LIMIT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment