diff mbox series

[v4,1/2] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data

Message ID 20220913180151.1928363-2-anna@kernel.org (mailing list archive)
State New, archived
Headers show
Series NFSD: Simplify READ_PLUS | expand

Commit Message

Anna Schumaker Sept. 13, 2022, 6:01 p.m. UTC
From: Anna Schumaker <Anna.Schumaker@Netapp.com>

This was discussed with Chuck as part of this patch set. Returning
nfserr_resource was decided to not be the best error message here, and
he suggested changing to nfserr_serverfault instead.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfsd/nfs4xdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chuck Lever III Sept. 13, 2022, 8:12 p.m. UTC | #1
> On Sep 13, 2022, at 11:01 AM, Anna Schumaker <anna@kernel.org> wrote:
> 
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> This was discussed with Chuck as part of this patch set. Returning
> nfserr_resource was decided to not be the best error message here, and
> he suggested changing to nfserr_serverfault instead.
> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
> fs/nfsd/nfs4xdr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I've applied this one for nfsd for-next. Thanks!

As I mentioned, 2/2 looks OK, and I'll apply it to my private
tree for testing while we work out why it's a little slower.


> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 1e9690a061ec..01dd73ed5720 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -3994,7 +3994,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
> 	}
> 	if (resp->xdr->buf->page_len && splice_ok) {
> 		WARN_ON_ONCE(1);
> -		return nfserr_resource;
> +		return nfserr_serverfault;

Odd, I couldn't find a definition for nfserr_serverfault when
I asked for this patch last week, but this one-liner seems to
compile correctly. Oh well!


> 	}
> 	xdr_commit_encode(xdr);
> 
> -- 
> 2.37.3
> 

--
Chuck Lever
Anna Schumaker Sept. 13, 2022, 8:42 p.m. UTC | #2
On Tue, Sep 13, 2022 at 4:12 PM Chuck Lever III <chuck.lever@oracle.com> wrote:
>
>
>
> > On Sep 13, 2022, at 11:01 AM, Anna Schumaker <anna@kernel.org> wrote:
> >
> > From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >
> > This was discussed with Chuck as part of this patch set. Returning
> > nfserr_resource was decided to not be the best error message here, and
> > he suggested changing to nfserr_serverfault instead.
> >
> > Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > ---
> > fs/nfsd/nfs4xdr.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> I've applied this one for nfsd for-next. Thanks!
>
> As I mentioned, 2/2 looks OK, and I'll apply it to my private
> tree for testing while we work out why it's a little slower.
>
>
> > diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> > index 1e9690a061ec..01dd73ed5720 100644
> > --- a/fs/nfsd/nfs4xdr.c
> > +++ b/fs/nfsd/nfs4xdr.c
> > @@ -3994,7 +3994,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
> >       }
> >       if (resp->xdr->buf->page_len && splice_ok) {
> >               WARN_ON_ONCE(1);
> > -             return nfserr_resource;
> > +             return nfserr_serverfault;
>
> Odd, I couldn't find a definition for nfserr_serverfault when
> I asked for this patch last week, but this one-liner seems to
> compile correctly. Oh well!

I found it in fs/nfsd/nfsd.h with `git grep`: #define
nfserr_serverfault      cpu_to_be32(NFSERR_SERVERFAULT)

Anna

>
>
> >       }
> >       xdr_commit_encode(xdr);
> >
> > --
> > 2.37.3
> >
>
> --
> Chuck Lever
>
>
>
Jeff Layton Sept. 15, 2022, 7:59 p.m. UTC | #3
On Tue, 2022-09-13 at 14:01 -0400, Anna Schumaker wrote:
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> This was discussed with Chuck as part of this patch set. Returning
> nfserr_resource was decided to not be the best error message here, and
> he suggested changing to nfserr_serverfault instead.
> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
>  fs/nfsd/nfs4xdr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 1e9690a061ec..01dd73ed5720 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -3994,7 +3994,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
>  	}
>  	if (resp->xdr->buf->page_len && splice_ok) {
>  		WARN_ON_ONCE(1);
> -		return nfserr_resource;
> +		return nfserr_serverfault;
>  	}
>  	xdr_commit_encode(xdr);
>  

IIRC the problem is that nfserr_resource is not valid in v4.1+. Do we
also need to change the nfserr_resource return in the if block above
this one?
Chuck Lever III Sept. 16, 2022, 2:17 a.m. UTC | #4
> On Sep 15, 2022, at 12:59 PM, Jeff Layton <jlayton@kernel.org> wrote:
> 
> On Tue, 2022-09-13 at 14:01 -0400, Anna Schumaker wrote:
>> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
>> 
>> This was discussed with Chuck as part of this patch set. Returning
>> nfserr_resource was decided to not be the best error message here, and
>> he suggested changing to nfserr_serverfault instead.
>> 
>> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
>> ---
>> fs/nfsd/nfs4xdr.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
>> index 1e9690a061ec..01dd73ed5720 100644
>> --- a/fs/nfsd/nfs4xdr.c
>> +++ b/fs/nfsd/nfs4xdr.c
>> @@ -3994,7 +3994,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
>> 	}
>> 	if (resp->xdr->buf->page_len && splice_ok) {
>> 		WARN_ON_ONCE(1);
>> -		return nfserr_resource;
>> +		return nfserr_serverfault;
>> 	}
>> 	xdr_commit_encode(xdr);
>> 
> 
> IIRC the problem is that nfserr_resource is not valid in v4.1+. Do we
> also need to change the nfserr_resource return in the if block above
> this one?

I discovered that nfsd4_encode_operation() converts nfserr_resource
to the status code that is proper for the minor version that is in
use. We're good to go there.

--
Chuck Lever
Jeff Layton Oct. 6, 2022, 4:35 p.m. UTC | #5
On Tue, 2022-09-13 at 14:01 -0400, Anna Schumaker wrote:
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> This was discussed with Chuck as part of this patch set. Returning
> nfserr_resource was decided to not be the best error message here, and
> he suggested changing to nfserr_serverfault instead.
> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
>  fs/nfsd/nfs4xdr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 1e9690a061ec..01dd73ed5720 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -3994,7 +3994,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
>  	}
>  	if (resp->xdr->buf->page_len && splice_ok) {
>  		WARN_ON_ONCE(1);
> -		return nfserr_resource;
> +		return nfserr_serverfault;
>  	}
>  	xdr_commit_encode(xdr);
>  


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

Patch

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 1e9690a061ec..01dd73ed5720 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3994,7 +3994,7 @@  nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
 	}
 	if (resp->xdr->buf->page_len && splice_ok) {
 		WARN_ON_ONCE(1);
-		return nfserr_resource;
+		return nfserr_serverfault;
 	}
 	xdr_commit_encode(xdr);