diff mbox series

NFSD: dst server needs to unmount src server's export after copy is done.

Message ID 20210302194843.98612-1-dai.ngo@oracle.com (mailing list archive)
State New
Headers show
Series NFSD: dst server needs to unmount src server's export after copy is done. | expand

Commit Message

Dai Ngo March 2, 2021, 7:48 p.m. UTC
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(-)

Comments

Chuck Lever III March 8, 2021, 4:03 p.m. UTC | #1
> 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
diff mbox series

Patch

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