Linux NFS development
 help / color / mirror / Atom feed
From: "Jörg Sommer" <joerg@jo-so.de>
To: NeilBrown <neil@brown.name>
Cc: Chuck Lever <cel@kernel.org>, Jeff Layton <jlayton@kernel.org>,
	 Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	 linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH 2/2] NFS: NFSERR_INVAL is not defined by NFSv2
Date: Fri, 28 Aug 2026 13:59:42 +0200	[thread overview]
Message-ID: <apF3Kv66IaDONfqo@jo-so.de> (raw)
In-Reply-To: <178791679053.3510150.70411349578293852@noble.neil.brown.name>

[-- Attachment #1: Type: text/plain, Size: 5581 bytes --]

NeilBrown schrieb am Fr 28. Aug, 21:33 (+1000):
> On Fri, 28 Aug 2026, Jörg Sommer wrote:
> > Chuck Lever schrieb am Di 09. Dez, 19:28 (-0500):
> > > From: Chuck Lever <chuck.lever@oracle.com>
> > > 
> > > 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.
> > 
> > Hello,
> > 
> > since this commit 0ac903d1bfdce8ff40657c2b7d996947b72b6645 was added, U-Boot
> > 2022.04 (I don't know about newer versions) can no longer access symlinks in
> > NFS shares. When I revert this commit, U-Boot can load the file behind the
> > symlink. Real files are no problem.
> > 
> > The file I want to load is a symlink at the server:
> > 
> > ```
> > % ls -l /srv/nfs/boot/Image.gz*
> > lrwxrwxrwx 1 root root      41  7. Jul 16:29 /srv/nfs-con/boot/Image.gz -> Image.gz-5.15.213-imx8mm+gfffa4b6d4aea+p1
> > -rw-r--r-- 1 root root 5279373  7. Jul 16:29 /srv/nfs-con/boot/Image.gz-5.15.213-imx8mm+gfffa4b6d4aea+p1
> > ```
> > 
> > Without this commit:
> > 
> > ```
> > u-boot=> nfs 0x42000000 /srv/nfs/boot/Image.gz
> > Filename '/srv/nfs-con/boot/Image.gz'.
> > Load address: 0x42000000
> > Loading: #################################################################
> > done
> > Bytes transferred = 5279373 (508e8d hex)
> > ```
> > 
> > But with this commit:
> > 
> > ```
> > u-boot=> nfs 0x42000000 /srv/nfs/boot/Image.gz
> > Filename '/srv/nfs-con/boot/Image.gz'.
> > Load address: 0x42000000
> > Loading:
> > done
> > ```
> > 
> > This is the network traffic:
> > 
> > ```
> > No.	Time	Protocol	Length	Info
> > 3	0.000370	Portmap	98	V2 GETPORT Call (Reply In 4) MOUNT(100005) V:1 UDP
> > 4	0.000607	Portmap	70	V2 GETPORT Reply (Call In 3) Port:60340
> > 5	0.000949	Portmap	98	V2 GETPORT Call (Reply In 6) NFS(100003) V:2 UDP
> > 6	0.001046	Portmap	70	V2 GETPORT Reply (Call In 5) Port:2049
> > 7	0.001368	MOUNT	126	V2 MNT Call (Reply In 8) /srv/nfs-con/boot
> > 8	0.008026	MOUNT	102	V2 MNT Reply (Call In 7)
> > 9	0.008389	NFS	146	V2 LOOKUP Call (Reply In 10), DH: 0x8c279135/Image.gz
> > 10	0.008754	NFS	170	V2 LOOKUP Reply (Call In 9), FH: 0xcdddf154
> > 11	0.009095	NFS	146	V2 READ Call (Reply In 12), FH: 0xcdddf154 Offset: 0 Count: 1024 TotalCount: 0
> > 12	0.009189	NFS	70	V2 READ Reply (Call In 11) Error: NFS2ERR_IO
> > 13	0.009511	MOUNT	102	V2 UMNTALL Call (Reply In 14)
> > 14	0.010301	MOUNT	66	V2 UMNTALL Reply (Call In 13)
> > ```
> > 
> > From packet 11 V2 READ Call
> > 
> > ```
> > Remote Procedure Call, Type:Call XID:0x000050e1
> >     XID: 0x000050e1 (20705)
> >     Message Type: Call (0)
> >     RPC Version: 2
> >     Program: NFS (100003)
> >     Program Version: 2
> >     Procedure: READ (6)
> >     [The reply to this request is in frame 12]
> >     Credentials
> >         Flavor: AUTH_UNIX (1)
> >         Length: 20
> >         Stamp: 0x00000000
> >         Machine Name: <EMPTY>
> >         UID: 0
> >         GID: 0
> >         Auxiliary GIDs (0)
> >     Verifier
> >         Flavor: AUTH_NULL (0)
> >         Length: 0
> > Network File System, READ Call FH: 0xcdddf154 Offset: 0 Count: 1024 TotalCount: 0
> >     [Program Version: 2]
> >     [V2 Procedure: READ (6)]
> >     file
> >         [hash (CRC-32): 0xcdddf154]
> >         FileHandle: 010004010100540020bb3809040054002f2edde4000000000000000000000000
> >     Offset: 0
> >     Count: 1024
> >     Total Count: 0
> > ```
> > 
> > From packet 12 V2 READ Reply
> > 
> > ```
> > Remote Procedure Call, Type:Reply XID:0x000050e1
> >     XID: 0x000050e1 (20705)
> >     Message Type: Reply (1)
> >     [Program: NFS (100003)]
> >     [Program Version: 2]
> >     [Procedure: READ (6)]
> >     Reply State: accepted (0)
> >     [This is a reply to a request in frame 11]
> >     [Time from request: 94.000 microseconds]
> >     Verifier
> >         Flavor: AUTH_NULL (0)
> >         Length: 0
> >     Accept State: RPC executed successfully (0)
> > Network File System, READ Reply  Error: NFS2ERR_IO
> >     [Program Version: 2]
> >     [V2 Procedure: READ (6)]
> >     Status: NFS2ERR_IO (5)
> > ```
> > 
> > 
> > I can locally revert this commit in our kernel, but is there any other way
> > to get it working again?
> 
> This is unfortunate.
> U-boot has
> 
> 		} else if ((rlen == -NFSERR_ISDIR) || (rlen == -NFSERR_INVAL)) {
> 			/* symbolic link */
> 			nfs_state = STATE_READLINK_REQ;
> 			nfs_send();
> 
> so we either need nfsdv2 to return NFSERR_ISDIR (for something that
> isn't a directory) or NFSERR_INVAL (which is not a valid v2 error code),
> or change u-boot to also check for NFSERR_IO (which is 5).
> 
> There is no "good" option.
> I suspect we should revert this change and document that we violate the
> RFC for historical compatibility with u-boot.

Maybe not revert the whole change, but add an exception for symlinks.

+++ fs/nfsd/nfsproc.c
@@ -33,7 +33,7 @@ static __be32 nfsd_map_status(__be32 status)
           break;
   case nfserr_symlink:
+          /* this is invalid, but U-Boot ... */
+          status = nfserr_inval;
+          break;

   case nfserr_wrong_type:
-          status = nfserr_inval;
+          status = nfserr_io;


-- 
Es liegt in der Natur des Menschen, vernünftig zu denken und
unlogisch zu handeln! Das Gesagte ist nicht das Gemeinte und das Gehörte
nicht das Verstandene!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-08-28 11:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10  0:28 [PATCH 0/2] Address minor issues with status codes Chuck Lever
2025-12-10  0:28 ` [PATCH 1/2] NFSD: Remove NFSERR_EAGAIN Chuck Lever
2025-12-10  0:28 ` [PATCH 2/2] NFS: NFSERR_INVAL is not defined by NFSv2 Chuck Lever
2026-08-28  8:48   ` Jörg Sommer
2026-08-28 11:33     ` NeilBrown
2026-08-28 11:59       ` Jörg Sommer [this message]
2026-08-28 13:27       ` Chuck Lever
2026-08-28 20:51         ` Tom Rini
2026-08-28 21:06           ` Chuck Lever
2026-08-28 21:18             ` Tom Rini
2026-08-28 22:04               ` Chuck Lever
2026-08-28 22:12                 ` Tom Rini
2026-08-28 22:36                 ` NeilBrown
2026-08-28 23:14                   ` Chuck Lever
2025-12-10  0:49 ` [PATCH 0/2] Address minor issues with status codes Jeff Layton
2025-12-10  1:01   ` NeilBrown

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=apF3Kv66IaDONfqo@jo-so.de \
    --to=joerg@jo-so.de \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /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