public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFSD: MKNOD should return NFSERR_BADTYPE instead of NFSERR_INVAL
Date: Fri, 6 Nov 2020 17:28:22 -0500	[thread overview]
Message-ID: <20201106222822.GH26028@fieldses.org> (raw)
In-Reply-To: <160346407256.79082.7549570817445542217.stgit@klimt.1015granger.net>

And, applied.  I should see about sending a pull request Monday....--b.

On Fri, Oct 23, 2020 at 10:41:12AM -0400, Chuck Lever wrote:
> A late paragraph of RFC 1813 Section 3.3.11 states:
> 
> | ... if the server does not support the target type or the
> | target type is illegal, the error, NFS3ERR_BADTYPE, should
> | be returned. Note that NF3REG, NF3DIR, and NF3LNK are
> | illegal types for MKNOD.
> 
> The Linux NFS server incorrectly returns NFSERR_INVAL in these
> cases.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/nfs3proc.c |    6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> index 14468613d150..a633044b0dc1 100644
> --- a/fs/nfsd/nfs3proc.c
> +++ b/fs/nfsd/nfs3proc.c
> @@ -316,10 +316,6 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
>  	fh_copy(&resp->dirfh, &argp->fh);
>  	fh_init(&resp->fh, NFS3_FHSIZE);
>  
> -	if (argp->ftype == 0 || argp->ftype >= NF3BAD) {
> -		resp->status = nfserr_inval;
> -		goto out;
> -	}
>  	if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
>  		rdev = MKDEV(argp->major, argp->minor);
>  		if (MAJOR(rdev) != argp->major ||
> @@ -328,7 +324,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
>  			goto out;
>  		}
>  	} else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
> -		resp->status = nfserr_inval;
> +		resp->status = nfserr_badtype;
>  		goto out;
>  	}
>  
> 

      reply	other threads:[~2020-11-06 22:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 14:41 [PATCH] NFSD: MKNOD should return NFSERR_BADTYPE instead of NFSERR_INVAL Chuck Lever
2020-11-06 22:28 ` J. Bruce Fields [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201106222822.GH26028@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox