public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd: Don't keep looking up unhashed files in the nfsd file cache
@ 2021-02-19  2:02 trondmy
  2021-02-24 20:59 ` J. Bruce Fields
  0 siblings, 1 reply; 3+ messages in thread
From: trondmy @ 2021-02-19  2:02 UTC (permalink / raw)
  To: J. Bruce Fields, Chuck Lever; +Cc: linux-nfs

From: Trond Myklebust <trond.myklebust@hammerspace.com>

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>
---
 fs/nfsd/filecache.c | 2 ++
 1 file changed, 2 insertions(+)

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;
 	}
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nfsd: Don't keep looking up unhashed files in the nfsd file cache
  2021-02-19  2:02 [PATCH] nfsd: Don't keep looking up unhashed files in the nfsd file cache trondmy
@ 2021-02-24 20:59 ` J. Bruce Fields
  2021-02-24 21:01   ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: J. Bruce Fields @ 2021-02-24 20:59 UTC (permalink / raw)
  To: trondmy; +Cc: J. Bruce Fields, Chuck Lever, linux-nfs

On Thu, Feb 18, 2021 at 09:02:07PM -0500, trondmy@kernel.org wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> 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()

Looks good to me.--b.

> 
> Fixes: 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd")
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
>  fs/nfsd/filecache.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> 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;
>  	}
> -- 
> 2.29.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nfsd: Don't keep looking up unhashed files in the nfsd file cache
  2021-02-24 20:59 ` J. Bruce Fields
@ 2021-02-24 21:01   ` Chuck Lever
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2021-02-24 21:01 UTC (permalink / raw)
  To: Bruce Fields, trondmy@kernel.org; +Cc: Bruce Fields, Linux NFS Mailing List



> On Feb 24, 2021, at 3:59 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> 
> On Thu, Feb 18, 2021 at 09:02:07PM -0500, trondmy@kernel.org wrote:
>> From: Trond Myklebust <trond.myklebust@hammerspace.com>
>> 
>> 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()
> 
> 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


>> Fixes: 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd")
>> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
>> ---
>> fs/nfsd/filecache.c | 2 ++
>> 1 file changed, 2 insertions(+)
>> 
>> 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;
>> 	}
>> -- 
>> 2.29.2

--
Chuck Lever




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-24 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-19  2:02 [PATCH] nfsd: Don't keep looking up unhashed files in the nfsd file cache trondmy
2021-02-24 20:59 ` J. Bruce Fields
2021-02-24 21:01   ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox