Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFS: NFSERR_INVAL is not defined by NFSv2

A documenting comment in include/uapi/linux/nfs.h claims incorrectly
that NFSv2 defines NFSERR_INVAL. There is no such definition in either
RFC 1094 or https://pubs.opengroup.org/onlinepubs/9629799/chap7.htm

NFS3ERR_INVAL is introduced in RFC 1813.

NFSD returns NFSERR_INVAL for PROC_GETACL, which has no
specification (yet).

However, nfsd_map_status() maps nfserr_symlink and nfserr_wrong_type
to nfserr_inval, which does not align with RFC 1094. This logic was
introduced only recently by commit 438f81e0e92a ("nfsd: move error
choice for incorrect object types to version-specific code."). Given
that we have no INVAL or SERVERFAULT status in NFSv2, probably the
only choice is NFSERR_IO.

Fixes: 438f81e0e92a ("nfsd: move error choice for incorrect object types to version-specific code.")
Reviewed-by: NeilBrown <neil@brown.name>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+3 -3
+1 -1
fs/nfsd/nfs2acl.c
··· 45 45 inode = d_inode(fh->fh_dentry); 46 46 47 47 if (argp->mask & ~NFS_ACL_MASK) { 48 - resp->status = nfserr_inval; 48 + resp->status = nfserr_io; 49 49 goto out; 50 50 } 51 51 resp->mask = argp->mask;
+1 -1
fs/nfsd/nfsproc.c
··· 33 33 break; 34 34 case nfserr_symlink: 35 35 case nfserr_wrong_type: 36 - status = nfserr_inval; 36 + status = nfserr_io; 37 37 break; 38 38 } 39 39 return status;
+1 -1
include/uapi/linux/nfs.h
··· 55 55 NFSERR_NODEV = 19, /* v2 v3 v4 */ 56 56 NFSERR_NOTDIR = 20, /* v2 v3 v4 */ 57 57 NFSERR_ISDIR = 21, /* v2 v3 v4 */ 58 - NFSERR_INVAL = 22, /* v2 v3 v4 */ 58 + NFSERR_INVAL = 22, /* v3 v4 */ 59 59 NFSERR_FBIG = 27, /* v2 v3 v4 */ 60 60 NFSERR_NOSPC = 28, /* v2 v3 v4 */ 61 61 NFSERR_ROFS = 30, /* v2 v3 v4 */