From: Trond Myklebust Date: Fri, 19 Feb 2021 02:02:07 +0000 (-0500) Subject: nfsd: Don't keep looking up unhashed files in the nfsd file cache X-Git-Tag: v5.12-rc4~34^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d30881f573e565ebb5dbb50b31ed6106b5c81328;p=thirdparty%2Flinux.git nfsd: Don't keep looking up unhashed files in the nfsd file cache 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 Signed-off-by: Chuck Lever --- diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 53fcbf79bdca3..7629248fdd532 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -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; }