All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] NFSD: fix dest to src mount in inter-server COPY
@ 2021-03-09 14:41 Olga Kornievskaia
  2021-03-09 18:21 ` dai.ngo
  0 siblings, 1 reply; 3+ messages in thread
From: Olga Kornievskaia @ 2021-03-09 14:41 UTC (permalink / raw)
  To: bfields, chuck.lever; +Cc: linux-nfs

From: Olga Kornievskaia <kolga@netapp.com>

A cleanup of the inter SSC copy needs to call fput() of the source
file handle to make sure that file structure is freed as well as
drop the reference on the superblock to unmount the source server.

Fixes: 36e1e5ba90fb ("NFSD: Fix use-after-free warning when doing inter-server copy")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfsd/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 8d6d2678abad..3581ce737e85 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1304,7 +1304,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
 			struct nfsd_file *dst)
 {
 	nfs42_ssc_close(src->nf_file);
-	/* 'src' is freed by nfsd4_do_async_copy */
+	fput(src->nf_file);
 	nfsd_file_put(dst);
 	mntput(ss_mnt);
 }
-- 
2.27.0


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

* Re: [PATCH 1/1] NFSD: fix dest to src mount in inter-server COPY
  2021-03-09 14:41 [PATCH 1/1] NFSD: fix dest to src mount in inter-server COPY Olga Kornievskaia
@ 2021-03-09 18:21 ` dai.ngo
  2021-03-10 15:54   ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: dai.ngo @ 2021-03-09 18:21 UTC (permalink / raw)
  To: Olga Kornievskaia, bfields, chuck.lever; +Cc: linux-nfs

On 3/9/21 6:41 AM, Olga Kornievskaia wrote:

> From: Olga Kornievskaia <kolga@netapp.com>
>
> A cleanup of the inter SSC copy needs to call fput() of the source
> file handle to make sure that file structure is freed as well as
> drop the reference on the superblock to unmount the source server.

Thanks Olga, I tested the patch and verified that the source was
unmounted and the file resources were released properly.

Tested-by: Dai Ngo <dai.ngo@oracle.com>

>
> Fixes: 36e1e5ba90fb ("NFSD: Fix use-after-free warning when doing inter-server copy")
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
>   fs/nfsd/nfs4proc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 8d6d2678abad..3581ce737e85 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1304,7 +1304,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
>   			struct nfsd_file *dst)
>   {
>   	nfs42_ssc_close(src->nf_file);
> -	/* 'src' is freed by nfsd4_do_async_copy */
> +	fput(src->nf_file);
>   	nfsd_file_put(dst);
>   	mntput(ss_mnt);
>   }

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

* Re: [PATCH 1/1] NFSD: fix dest to src mount in inter-server COPY
  2021-03-09 18:21 ` dai.ngo
@ 2021-03-10 15:54   ` Chuck Lever
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2021-03-10 15:54 UTC (permalink / raw)
  To: Dai Ngo, Olga Kornievskaia; +Cc: Bruce Fields, Linux NFS Mailing List



> On Mar 9, 2021, at 1:21 PM, Dai Ngo <dai.ngo@oracle.com> wrote:
> 
> On 3/9/21 6:41 AM, Olga Kornievskaia wrote:
> 
>> From: Olga Kornievskaia <kolga@netapp.com>
>> 
>> A cleanup of the inter SSC copy needs to call fput() of the source
>> file handle to make sure that file structure is freed as well as
>> drop the reference on the superblock to unmount the source server.
> 
> Thanks Olga, I tested the patch and verified that the source was
> unmounted and the file resources were released properly.
> 
> Tested-by: Dai Ngo <dai.ngo@oracle.com>

Thanks to you both! This has been added to the for-rc topic branch
in:

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

replacing Dai's earlier patch addressing the same issue.


>> Fixes: 36e1e5ba90fb ("NFSD: Fix use-after-free warning when doing inter-server copy")
>> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
>> ---
>>  fs/nfsd/nfs4proc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
>> index 8d6d2678abad..3581ce737e85 100644
>> --- a/fs/nfsd/nfs4proc.c
>> +++ b/fs/nfsd/nfs4proc.c
>> @@ -1304,7 +1304,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
>>  			struct nfsd_file *dst)
>>  {
>>  	nfs42_ssc_close(src->nf_file);
>> -	/* 'src' is freed by nfsd4_do_async_copy */
>> +	fput(src->nf_file);
>>  	nfsd_file_put(dst);
>>  	mntput(ss_mnt);
>>  }

--
Chuck Lever




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

end of thread, other threads:[~2021-03-10 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 14:41 [PATCH 1/1] NFSD: fix dest to src mount in inter-server COPY Olga Kornievskaia
2021-03-09 18:21 ` dai.ngo
2021-03-10 15:54   ` Chuck Lever

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.