All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFSD: Fix nfs4_delegation_stat()
@ 2024-09-09 14:15 cel
  2024-09-09 14:23 ` Jeff Layton
  0 siblings, 1 reply; 2+ messages in thread
From: cel @ 2024-09-09 14:15 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-nfs, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

The xfstests workflow on NFSv4.2 exhausts the capacity of both the
main and scratch devices (backed by xfs) about half-way through
each test run.

Deleting all visible files on both devices frees only a little bit
of space. The test exports can be unshared but not unmounted
(EBUSY). Looks like unlinked but still open files, maybe.

Bisected to commit c495f65ad2ff ("nfsd: fix initial getattr on write
delegation")

Ensure nfsd_file objects acquired by find_rw_file() are released.

Fixes: c495f65ad2ff ("nfsd: fix initial getattr on write delegation")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs4state.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Tested, problem no longer reproducible. I intend to squash this into
c495f65ad2ff.

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 252297b98a2e..cb5a9ab451c5 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5920,6 +5920,7 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh,
 {
 	struct nfsd_file *nf = find_rw_file(dp->dl_stid.sc_file);
 	struct path path;
+	int rc;
 
 	if (!nf)
 		return false;
@@ -5927,11 +5928,12 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh,
 	path.mnt = currentfh->fh_export->ex_path.mnt;
 	path.dentry = file_dentry(nf->nf_file);
 
-	if (vfs_getattr(&path, stat,
-			(STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE),
-			AT_STATX_SYNC_AS_STAT))
-		return false;
-	return true;
+	rc = vfs_getattr(&path, stat,
+			 (STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE),
+			 AT_STATX_SYNC_AS_STAT);
+
+	nfsd_file_put(nf);
+	return rc == 0;
 }
 
 /*
-- 
2.45.2


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

* Re: [PATCH] NFSD: Fix nfs4_delegation_stat()
  2024-09-09 14:15 [PATCH] NFSD: Fix nfs4_delegation_stat() cel
@ 2024-09-09 14:23 ` Jeff Layton
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2024-09-09 14:23 UTC (permalink / raw)
  To: cel; +Cc: linux-nfs, Chuck Lever

On Mon, 2024-09-09 at 10:15 -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> The xfstests workflow on NFSv4.2 exhausts the capacity of both the
> main and scratch devices (backed by xfs) about half-way through
> each test run.
> 
> Deleting all visible files on both devices frees only a little bit
> of space. The test exports can be unshared but not unmounted
> (EBUSY). Looks like unlinked but still open files, maybe.
> 
> Bisected to commit c495f65ad2ff ("nfsd: fix initial getattr on write
> delegation")
> 
> Ensure nfsd_file objects acquired by find_rw_file() are released.
> 
> Fixes: c495f65ad2ff ("nfsd: fix initial getattr on write delegation")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/nfs4state.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> Tested, problem no longer reproducible. I intend to squash this into
> c495f65ad2ff.
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 252297b98a2e..cb5a9ab451c5 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -5920,6 +5920,7 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh,
>  {
>  	struct nfsd_file *nf = find_rw_file(dp->dl_stid.sc_file);
>  	struct path path;
> +	int rc;
>  
>  	if (!nf)
>  		return false;
> @@ -5927,11 +5928,12 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh,
>  	path.mnt = currentfh->fh_export->ex_path.mnt;
>  	path.dentry = file_dentry(nf->nf_file);
>  
> -	if (vfs_getattr(&path, stat,
> -			(STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE),
> -			AT_STATX_SYNC_AS_STAT))
> -		return false;
> -	return true;
> +	rc = vfs_getattr(&path, stat,
> +			 (STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE),
> +			 AT_STATX_SYNC_AS_STAT);
> +
> +	nfsd_file_put(nf);
> +	return rc == 0;
>  }
>  
>  /*

Mea culpa!

Reviewed-by: Jeff Layton <jlayton@kernel.org>

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

end of thread, other threads:[~2024-09-09 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-09 14:15 [PATCH] NFSD: Fix nfs4_delegation_stat() cel
2024-09-09 14:23 ` Jeff Layton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.