Skip to content

Commit 66d60e3

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
NFSD: MKNOD should return NFSERR_BADTYPE instead of NFSERR_INVAL
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> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent d321ff5 commit 66d60e3

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

fs/nfsd/nfs3proc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,6 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
316316
fh_copy(&resp->dirfh, &argp->fh);
317317
fh_init(&resp->fh, NFS3_FHSIZE);
318318

319-
if (argp->ftype == 0 || argp->ftype >= NF3BAD) {
320-
resp->status = nfserr_inval;
321-
goto out;
322-
}
323319
if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
324320
rdev = MKDEV(argp->major, argp->minor);
325321
if (MAJOR(rdev) != argp->major ||
@@ -328,7 +324,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
328324
goto out;
329325
}
330326
} else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
331-
resp->status = nfserr_inval;
327+
resp->status = nfserr_badtype;
332328
goto out;
333329
}
334330

0 commit comments

Comments
 (0)