diff mbox series

[v12,20/24] nfsd: use GC for nfsd_file returned by nfsd_file_acquire_local

Message ID 20240819181750.70570-21-snitzer@kernel.org (mailing list archive)
State New
Headers show
Series nfs/nfsd: add support for localio | expand

Commit Message

Mike Snitzer Aug. 19, 2024, 6:17 p.m. UTC
Offers performance improvements if/when a file is reopened before
launderette cleans it from the filecache's LRU.

Suggested-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 fs/nfsd/filecache.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jeff Layton Aug. 21, 2024, 6:34 p.m. UTC | #1
On Mon, 2024-08-19 at 14:17 -0400, Mike Snitzer wrote:
> Offers performance improvements if/when a file is reopened before
> launderette cleans it from the filecache's LRU.
> 
> Suggested-by: Jeff Layton <jlayton@kernel.org>
> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
> ---
>  fs/nfsd/filecache.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 56be99a3667a..447faa194166 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -1197,9 +1197,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
>   * a file.  The security implications of this should be carefully
>   * considered before use.
>   *
> - * The nfsd_file_object returned by this API is reference-counted
> - * but not garbage-collected. The object is unhashed after the
> - * final nfsd_file_put().
> + * The nfsd_file object returned by this API is reference-counted
> + * and garbage-collected. The object is retained for a few
> + * seconds after the final nfsd_file_put() in case the caller
> + * wants to re-use it.
>   *
>   * Return values:
>   *   %nfs_ok - @pnf points to an nfsd_file with its reference
> @@ -1214,7 +1215,7 @@ nfsd_file_acquire_local(struct net *net, struct svc_cred *cred,
>  			unsigned int may_flags, struct nfsd_file **pnf)
>  {
>  	return nfsd_file_do_acquire(NULL, net, cred, nfs_vers, client,
> -				    fhp, may_flags, NULL, pnf, false);
> +				    fhp, may_flags, NULL, pnf, true);
>  }
>  
>  /**

I'd just squash this into patch #6.
diff mbox series

Patch

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 56be99a3667a..447faa194166 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -1197,9 +1197,10 @@  nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
  * a file.  The security implications of this should be carefully
  * considered before use.
  *
- * The nfsd_file_object returned by this API is reference-counted
- * but not garbage-collected. The object is unhashed after the
- * final nfsd_file_put().
+ * The nfsd_file object returned by this API is reference-counted
+ * and garbage-collected. The object is retained for a few
+ * seconds after the final nfsd_file_put() in case the caller
+ * wants to re-use it.
  *
  * Return values:
  *   %nfs_ok - @pnf points to an nfsd_file with its reference
@@ -1214,7 +1215,7 @@  nfsd_file_acquire_local(struct net *net, struct svc_cred *cred,
 			unsigned int may_flags, struct nfsd_file **pnf)
 {
 	return nfsd_file_do_acquire(NULL, net, cred, nfs_vers, client,
-				    fhp, may_flags, NULL, pnf, false);
+				    fhp, may_flags, NULL, pnf, true);
 }
 
 /**