All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Dai Ngo <dai.ngo@oracle.com>, chuck.lever@oracle.com
Cc: aglo@umich.edu, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] NFSD: fix leak referent count of nfsd4_ssc_umount_item in nfsd4_copy
Date: Tue, 24 Jan 2023 06:48:25 -0500	[thread overview]
Message-ID: <d1ec3853d8709843e7e8fd70e463db2ee71b0bcd.camel@kernel.org> (raw)
In-Reply-To: <1674538453-12998-1-git-send-email-dai.ngo@oracle.com>

On Mon, 2023-01-23 at 21:34 -0800, Dai Ngo wrote:
> The reference count of nfsd4_ssc_umount_item is not decremented
> on error conditions. This prevents the laundromat from unmounting
> the vfsmount of the source file.
> 
> This patch decrements the reference count of nfsd4_ssc_umount_item
> on error.
> 
> Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> ---
>  fs/nfsd/nfs4proc.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index b4e7e18e1761..889b603619c3 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1821,13 +1821,17 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  out:
>  	return status;
>  out_err:
> +	if (nfsd4_ssc_is_inter(copy)) {
> +		/*
> +		 * Source's vfsmount of inter-copy will be unmounted
> +		 * by the laundromat. Use copy instead of async_copy
> +		 * since async_copy->ss_nsui might not be set yet.
> +	 	*/
> +		refcount_dec(&copy->ss_nsui->nsui_refcnt);
> +	}
>  	if (async_copy)
>  		cleanup_async_copy(async_copy);
>  	status = nfserrno(-ENOMEM);
> -	/*
> -	 * source's vfsmount of inter-copy will be unmounted
> -	 * by the laundromat
> -	 */
>  	goto out;
>  }
>  

Looks good.

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

  reply	other threads:[~2023-01-24 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24  5:34 [PATCH 1/1] NFSD: fix leak referent count of nfsd4_ssc_umount_item in nfsd4_copy Dai Ngo
2023-01-24 11:48 ` Jeff Layton [this message]
2023-01-24 16:54 ` Chuck Lever III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1ec3853d8709843e7e8fd70e463db2ee71b0bcd.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=aglo@umich.edu \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.