kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2] NFSD: Fix error return code in nfsd4_interssc_connect()
@ 2021-06-04 10:12 Wei Yongjun
  2021-06-04 14:40 ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2021-06-04 10:12 UTC (permalink / raw)
  To: weiyongjun1, J. Bruce Fields, Chuck Lever, Dai Ngo
  Cc: linux-nfs, kernel-janitors, Hulk Robot

'status' has been overwritten to 0 after nfsd4_ssc_setup_dul(), this
cause 0 will be return in vfs_kern_mount() error case. Fix to return
nfserr_nodev in this error.

Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 -> v2: change to return nfserr_nodev
---
 fs/nfsd/nfs4proc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 0bd71c6da81d..b082cbde3e07 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1323,6 +1323,7 @@ nfsd4_interssc_connect(struct nl4_server *nss, struct svc_rqst *rqstp,
 	ss_mnt = vfs_kern_mount(type, SB_KERNMOUNT, dev_name, raw_data);
 	module_put(type->owner);
 	if (IS_ERR(ss_mnt)) {
+		status = nfserr_nodev;
 		if (work)
 			nfsd4_ssc_cancel_dul_work(nn, work);
 		goto out_free_devname;


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

* Re: [PATCH -next v2] NFSD: Fix error return code in nfsd4_interssc_connect()
  2021-06-04 10:12 [PATCH -next v2] NFSD: Fix error return code in nfsd4_interssc_connect() Wei Yongjun
@ 2021-06-04 14:40 ` J. Bruce Fields
  2021-06-04 16:36   ` dai.ngo
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2021-06-04 14:40 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Chuck Lever, Dai Ngo, linux-nfs, kernel-janitors, Hulk Robot

On Fri, Jun 04, 2021 at 10:12:37AM +0000, Wei Yongjun wrote:
> 'status' has been overwritten to 0 after nfsd4_ssc_setup_dul(), this
> cause 0 will be return in vfs_kern_mount() error case. Fix to return
> nfserr_nodev in this error.

Why is that the right error?  I don't see it mentioned among the errors
COPY can return:

	https://datatracker.ietf.org/doc/html/rfc7862#page-50

It might be reasonable to just map the error returned by vfs_kern_mount
to an nfs error, I don't know--we'd need to think about the different
errors vfs_kern_mount might return.

OFFLOAD_DENIED seems safe as it should cause a fallback to a normal
copy.

Same goes for the other spot here where we return nodev.

--b.

> 
> Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> v1 -> v2: change to return nfserr_nodev
> ---
>  fs/nfsd/nfs4proc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 0bd71c6da81d..b082cbde3e07 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1323,6 +1323,7 @@ nfsd4_interssc_connect(struct nl4_server *nss, struct svc_rqst *rqstp,
>  	ss_mnt = vfs_kern_mount(type, SB_KERNMOUNT, dev_name, raw_data);
>  	module_put(type->owner);
>  	if (IS_ERR(ss_mnt)) {
> +		status = nfserr_nodev;
>  		if (work)
>  			nfsd4_ssc_cancel_dul_work(nn, work);
>  		goto out_free_devname;

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

* Re: [PATCH -next v2] NFSD: Fix error return code in nfsd4_interssc_connect()
  2021-06-04 14:40 ` J. Bruce Fields
@ 2021-06-04 16:36   ` dai.ngo
  2021-06-04 17:30     ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
From: dai.ngo @ 2021-06-04 16:36 UTC (permalink / raw)
  To: J. Bruce Fields, Wei Yongjun
  Cc: Chuck Lever, linux-nfs, kernel-janitors, Hulk Robot


On 6/4/21 7:40 AM, J. Bruce Fields wrote:
> On Fri, Jun 04, 2021 at 10:12:37AM +0000, Wei Yongjun wrote:
>> 'status' has been overwritten to 0 after nfsd4_ssc_setup_dul(), this
>> cause 0 will be return in vfs_kern_mount() error case. Fix to return
>> nfserr_nodev in this error.
> Why is that the right error?

That was the original error before it was overwritten by
nfsd4_ssc_setup_dul. However, it actually does not matter which
error nfsd4_interssc_connect returns to caller since nfsd4_copy
maps all errors to nfserr_offload_denied before returning it
to the client.

-Dai

> I don't see it mentioned among the errors
> COPY can return:
>
> 	https://urldefense.com/v3/__https://datatracker.ietf.org/doc/html/rfc7862*page-50__;Iw!!GqivPVa7Brio!NSHjr5li4vkJl0VAWWz2mrW2wiVn9wcJfK7ZJON3bmM8REVUqI82bS4FFQdajQ$
>
> It might be reasonable to just map the error returned by vfs_kern_mount
> to an nfs error, I don't know--we'd need to think about the different
> errors vfs_kern_mount might return.
>
> OFFLOAD_DENIED seems safe as it should cause a fallback to a normal
> copy.
>
> Same goes for the other spot here where we return nodev.
>
> --b.
>
>> Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>> v1 -> v2: change to return nfserr_nodev
>> ---
>>   fs/nfsd/nfs4proc.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
>> index 0bd71c6da81d..b082cbde3e07 100644
>> --- a/fs/nfsd/nfs4proc.c
>> +++ b/fs/nfsd/nfs4proc.c
>> @@ -1323,6 +1323,7 @@ nfsd4_interssc_connect(struct nl4_server *nss, struct svc_rqst *rqstp,
>>   	ss_mnt = vfs_kern_mount(type, SB_KERNMOUNT, dev_name, raw_data);
>>   	module_put(type->owner);
>>   	if (IS_ERR(ss_mnt)) {
>> +		status = nfserr_nodev;
>>   		if (work)
>>   			nfsd4_ssc_cancel_dul_work(nn, work);
>>   		goto out_free_devname;

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

* Re: [PATCH -next v2] NFSD: Fix error return code in nfsd4_interssc_connect()
  2021-06-04 16:36   ` dai.ngo
@ 2021-06-04 17:30     ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2021-06-04 17:30 UTC (permalink / raw)
  To: dai.ngo; +Cc: Wei Yongjun, Chuck Lever, linux-nfs, kernel-janitors, Hulk Robot

On Fri, Jun 04, 2021 at 09:36:58AM -0700, dai.ngo@oracle.com wrote:
> 
> On 6/4/21 7:40 AM, J. Bruce Fields wrote:
> >On Fri, Jun 04, 2021 at 10:12:37AM +0000, Wei Yongjun wrote:
> >>'status' has been overwritten to 0 after nfsd4_ssc_setup_dul(), this
> >>cause 0 will be return in vfs_kern_mount() error case. Fix to return
> >>nfserr_nodev in this error.
> >Why is that the right error?
> 
> That was the original error before it was overwritten by
> nfsd4_ssc_setup_dul. However, it actually does not matter which
> error nfsd4_interssc_connect returns to caller since nfsd4_copy
> maps all errors to nfserr_offload_denied before returning it
> to the client.

OK, I overlooked that.--b.

> 
> -Dai
> 
> >I don't see it mentioned among the errors
> >COPY can return:
> >
> >	https://urldefense.com/v3/__https://datatracker.ietf.org/doc/html/rfc7862*page-50__;Iw!!GqivPVa7Brio!NSHjr5li4vkJl0VAWWz2mrW2wiVn9wcJfK7ZJON3bmM8REVUqI82bS4FFQdajQ$
> >
> >It might be reasonable to just map the error returned by vfs_kern_mount
> >to an nfs error, I don't know--we'd need to think about the different
> >errors vfs_kern_mount might return.
> >
> >OFFLOAD_DENIED seems safe as it should cause a fallback to a normal
> >copy.
> >
> >Same goes for the other spot here where we return nodev.
> >
> >--b.
> >
> >>Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
> >>Reported-by: Hulk Robot <hulkci@huawei.com>
> >>Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> >>---
> >>v1 -> v2: change to return nfserr_nodev
> >>---
> >>  fs/nfsd/nfs4proc.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >>diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> >>index 0bd71c6da81d..b082cbde3e07 100644
> >>--- a/fs/nfsd/nfs4proc.c
> >>+++ b/fs/nfsd/nfs4proc.c
> >>@@ -1323,6 +1323,7 @@ nfsd4_interssc_connect(struct nl4_server *nss, struct svc_rqst *rqstp,
> >>  	ss_mnt = vfs_kern_mount(type, SB_KERNMOUNT, dev_name, raw_data);
> >>  	module_put(type->owner);
> >>  	if (IS_ERR(ss_mnt)) {
> >>+		status = nfserr_nodev;
> >>  		if (work)
> >>  			nfsd4_ssc_cancel_dul_work(nn, work);
> >>  		goto out_free_devname;

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

end of thread, other threads:[~2021-06-04 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 10:12 [PATCH -next v2] NFSD: Fix error return code in nfsd4_interssc_connect() Wei Yongjun
2021-06-04 14:40 ` J. Bruce Fields
2021-06-04 16:36   ` dai.ngo
2021-06-04 17:30     ` J. Bruce Fields

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).