linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSD: dst server needs to unmount src server's export after copy is done.
@ 2021-03-02 19:48 Dai Ngo
  2021-03-08 16:03 ` Chuck Lever
  0 siblings, 1 reply; 2+ messages in thread
From: Dai Ngo @ 2021-03-02 19:48 UTC (permalink / raw)
  To: olga.kornievskaia; +Cc: bfields, linux-nfs

Currently the destination server leaves the source server's export
intact on the destination after copy is done. This patch fixes this
by doing ssc disconnect from nfsd4_do_async_copy after copy is done.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/nfs4proc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 8d6d2678abad..d3d864b8ee4f 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1306,7 +1306,6 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
 	nfs42_ssc_close(src->nf_file);
 	/* 'src' is freed by nfsd4_do_async_copy */
 	nfsd_file_put(dst);
-	mntput(ss_mnt);
 }
 
 #else /* CONFIG_NFSD_V4_2_INTER_SSC */
@@ -1472,14 +1471,12 @@ static int nfsd4_do_async_copy(void *data)
 		copy->nf_src = kzalloc(sizeof(struct nfsd_file), GFP_KERNEL);
 		if (!copy->nf_src) {
 			copy->nfserr = nfserr_serverfault;
-			nfsd4_interssc_disconnect(copy->ss_mnt);
 			goto do_callback;
 		}
 		copy->nf_src->nf_file = nfs42_ssc_open(copy->ss_mnt, &copy->c_fh,
 					      &copy->stateid);
 		if (IS_ERR(copy->nf_src->nf_file)) {
 			copy->nfserr = nfserr_offload_denied;
-			nfsd4_interssc_disconnect(copy->ss_mnt);
 			goto do_callback;
 		}
 	}
@@ -1498,8 +1495,10 @@ static int nfsd4_do_async_copy(void *data)
 			&nfsd4_cb_offload_ops, NFSPROC4_CLNT_CB_OFFLOAD);
 	nfsd4_run_cb(&cb_copy->cp_cb);
 out:
-	if (!copy->cp_intra)
+	if (!copy->cp_intra) {
+		nfsd4_interssc_disconnect(copy->ss_mnt);
 		kfree(copy->nf_src);
+	}
 	cleanup_async_copy(copy);
 	return 0;
 }
-- 
2.9.5


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

* Re: [PATCH] NFSD: dst server needs to unmount src server's export after copy is done.
  2021-03-02 19:48 [PATCH] NFSD: dst server needs to unmount src server's export after copy is done Dai Ngo
@ 2021-03-08 16:03 ` Chuck Lever
  0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever @ 2021-03-08 16:03 UTC (permalink / raw)
  To: Dai Ngo; +Cc: Olga Kornievskaia, Bruce Fields, Linux NFS Mailing List



> On Mar 2, 2021, at 2:48 PM, Dai Ngo <dai.ngo@oracle.com> wrote:
> 
> Currently the destination server leaves the source server's export
> intact on the destination after copy is done. This patch fixes this
> by doing ssc disconnect from nfsd4_do_async_copy after copy is done.
> 
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>

I haven't seen any negative comments on this patch, so I've added it
to the for-rc topic branch at

git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git


> ---
> fs/nfsd/nfs4proc.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 8d6d2678abad..d3d864b8ee4f 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1306,7 +1306,6 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
> 	nfs42_ssc_close(src->nf_file);
> 	/* 'src' is freed by nfsd4_do_async_copy */
> 	nfsd_file_put(dst);
> -	mntput(ss_mnt);
> }
> 
> #else /* CONFIG_NFSD_V4_2_INTER_SSC */
> @@ -1472,14 +1471,12 @@ static int nfsd4_do_async_copy(void *data)
> 		copy->nf_src = kzalloc(sizeof(struct nfsd_file), GFP_KERNEL);
> 		if (!copy->nf_src) {
> 			copy->nfserr = nfserr_serverfault;
> -			nfsd4_interssc_disconnect(copy->ss_mnt);
> 			goto do_callback;
> 		}
> 		copy->nf_src->nf_file = nfs42_ssc_open(copy->ss_mnt, &copy->c_fh,
> 					      &copy->stateid);
> 		if (IS_ERR(copy->nf_src->nf_file)) {
> 			copy->nfserr = nfserr_offload_denied;
> -			nfsd4_interssc_disconnect(copy->ss_mnt);
> 			goto do_callback;
> 		}
> 	}
> @@ -1498,8 +1495,10 @@ static int nfsd4_do_async_copy(void *data)
> 			&nfsd4_cb_offload_ops, NFSPROC4_CLNT_CB_OFFLOAD);
> 	nfsd4_run_cb(&cb_copy->cp_cb);
> out:
> -	if (!copy->cp_intra)
> +	if (!copy->cp_intra) {
> +		nfsd4_interssc_disconnect(copy->ss_mnt);
> 		kfree(copy->nf_src);
> +	}
> 	cleanup_async_copy(copy);
> 	return 0;
> }
> -- 
> 2.9.5
> 

--
Chuck Lever




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

end of thread, other threads:[~2021-03-08 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 19:48 [PATCH] NFSD: dst server needs to unmount src server's export after copy is done Dai Ngo
2021-03-08 16:03 ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).