nfsd: Don't keep looking up unhashed files in the nfsd file cache
Subsystems (2)
[email protected]
maintainerPATCH 1/1 nfsd: Don't keep looking up unhashed files in the nfsd file cache
From: Trond Myklebust <[email protected]>
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()
--- fs/nfsd/filecache.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfsd/filecache.c +2 -0
@@ -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; }
Signature · 1 line
2.29.2
Quoted 6 lines · On Thu, Feb 18, 2021 at 09:02:07PM -0500, [email protected] wrote:
From: Trond Myklebust <[email protected]>
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_jukeboxreturns fromnfsd_file_acquire()
Looks good to me.--b.
Quoted 22 lines
Fixes 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd")Signed-off-by Trond Myklebust <[email protected]>--- fs/nfsd/filecache.c | 2 ++ 1 file changed, 2 insertions(+)fs/nfsd/filecache.c +2
-0@@ -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; }Signature · 1 line
2.29.2
Quoted 13 lines · J. Bruce Fields
Quoted 6 lines · On Thu, Feb 18, 2021 at 09:02:07PM -0500, [email protected] wrote:
From: Trond Myklebust <[email protected]>
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_jukeboxreturns fromnfsd_file_acquire()Looks good to me.--b.
Thanks for the review. This is now included in the for-rc topic branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
Quoted 6 lines
Quoted 6 lines
Fixes 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd")Signed-off-by Trond Myklebust <[email protected]>---
fs/nfsd/filecache.c| 2 ++1 file changed, 2 insertions(+)
Quoted 15 lines
Quoted 15 lines
fs/nfsd/filecache.c +2
-0@@ -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; }Signature · 1 line
2.29.2
--
Chuck Lever