]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFS: NFSERR_INVAL is not defined by NFSv2
authorChuck Lever <chuck.lever@oracle.com>
Wed, 10 Dec 2025 00:28:50 +0000 (19:28 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 26 Jan 2026 15:10:58 +0000 (10:10 -0500)
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>
fs/nfsd/nfs2acl.c
fs/nfsd/nfsproc.c
include/uapi/linux/nfs.h

index 5fb202acb0fd00af5058bd3681832050484f1792..0ac538c7618009ae63fbb7de18b6d8237d8d01f8 100644 (file)
@@ -45,7 +45,7 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst *rqstp)
        inode = d_inode(fh->fh_dentry);
 
        if (argp->mask & ~NFS_ACL_MASK) {
-               resp->status = nfserr_inval;
+               resp->status = nfserr_io;
                goto out;
        }
        resp->mask = argp->mask;
index 481e789a769749291d7b15e14959dd39fbf0e7e6..8873033d1e82f44fafba99877049fb8879a76319 100644 (file)
@@ -33,7 +33,7 @@ static __be32 nfsd_map_status(__be32 status)
                break;
        case nfserr_symlink:
        case nfserr_wrong_type:
-               status = nfserr_inval;
+               status = nfserr_io;
                break;
        }
        return status;
index 71c7196d32817d4e5eba7b3b15b43fc2868d48b4..e629c4953534567fc842c18c802d20c64ad35f99 100644 (file)
@@ -55,7 +55,7 @@
        NFSERR_NODEV = 19,              /* v2 v3 v4 */
        NFSERR_NOTDIR = 20,             /* v2 v3 v4 */
        NFSERR_ISDIR = 21,              /* v2 v3 v4 */
-       NFSERR_INVAL = 22,              /* v2 v3 v4 */
+       NFSERR_INVAL = 22,              /*    v3 v4 */
        NFSERR_FBIG = 27,               /* v2 v3 v4 */
        NFSERR_NOSPC = 28,              /* v2 v3 v4 */
        NFSERR_ROFS = 30,               /* v2 v3 v4 */