[PATCH 5.10 041/157] nfsd: Dont keep looking up unhashed files in the nfsd file cache
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-03-22 12:43:30
Also in:
lkml
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-03-22 12:43:30
Also in:
lkml
From: Trond Myklebust <redacted>
commit d30881f573e565ebb5dbb50b31ed6106b5c81328 upstream.
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 <redacted>
Signed-off-by: Chuck Lever <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/nfsd/filecache.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c@@ -897,6 +897,8 @@ nfsd_file_find_locked(struct inode *inod 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; }