summary refs log tree commit diff
path: root/fs/nfsd/filecache.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-02-18 21:02:07 -0500
committerChuck Lever <chuck.lever@oracle.com>2021-03-06 16:41:47 -0500
commitd30881f573e565ebb5dbb50b31ed6106b5c81328 (patch)
treefaf91b79b0e23263b6397844d6f746606a9790bd /fs/nfsd/filecache.c
parenta38fd8748464831584a19438cbb3082b5a2dab15 (diff)
downloadlinux-d30881f573e565ebb5dbb50b31ed6106b5c81328.tar.gz
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 <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/filecache.c')
-rw-r--r--fs/nfsd/filecache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 53fcbf79bdca..7629248fdd53 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;
 	}