]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nfsd: Don't keep looking up unhashed files in the nfsd file cache
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 19 Feb 2021 02:02:07 +0000 (21:02 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 6 Mar 2021 21:41:47 +0000 (16:41 -0500)
If a file is unhashed, then we're going to reject it anyway and retry,
so make sure we skip it when we're doing the RCU lockless lookup.
This avoids a number of unnecessary nfserr_jukebox returns from
nfsd_file_acquire()

Fixes: 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c

index 53fcbf79bdca3ac7ea7c43e9222a1b79700f818b..7629248fdd532885d35423968c396dbbe9d56a6a 100644 (file)
@@ -898,6 +898,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags,
                        continue;
                if (!nfsd_match_cred(nf->nf_cred, current_cred()))
                        continue;
+               if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
+                       continue;
                if (nfsd_file_get(nf) != NULL)
                        return nf;
        }