[PATCH] nfs: Handle NFSERR_IO as symlink

Jörg Sommer <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <1d8518e3944411ede8e6be4e060e15d67ffb42f8.1787944217.git.joerg@jo-so.de>
The Linux kernel's NFSd changed [1] its response code on access of symbolic
links to be RFC 1094 compliant. When a symbolic link is encountered in NFSv2
mode it returns no longer NFSERR_INVAL (22) but NFSERR_IO (5).

This change from 7.0-rc1 got backported to different other versions like
6.12.75 and 6.18.14. Therefore, U-Boot needs to handle this new response
code.

[1] https://lore.kernel.org/all/[email protected]/

Signed-off-by: Jörg Sommer <[email protected]>
---

There's a discussion going how to hande this in the kernel:
https://lore.kernel.org/all/[email protected]/

 net/nfs-common.c | 3 ++-
 net/nfs-common.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/nfs-common.c b/net/nfs-common.c
index 637fcfd9bb8..ee24cd07196 100644
--- a/net/nfs-common.c
+++ b/net/nfs-common.c
@@ -855,7 +855,8 @@ void nfs_pkt_recv(uchar *pkt, unsigned int len)
 		if (rlen > 0) {
 			nfs_offset += rlen;
 			nfs_send();
-		} else if ((rlen == -NFSERR_ISDIR) || (rlen == -NFSERR_INVAL)) {
+		} else if ((rlen == -NFSERR_ISDIR) || (rlen == -NFSERR_INVAL) ||
+			   (rlen == -NFSERR_IO)) {
 			/* symbolic link */
 			nfs_state = STATE_READLINK_REQ;
 			nfs_send();
diff --git a/net/nfs-common.h b/net/nfs-common.h
index a19b98b7b1f..04671d3c87a 100644
--- a/net/nfs-common.h
+++ b/net/nfs-common.h
@@ -23,6 +23,7 @@
 
 #define NFSERR_PERM     1
 #define NFSERR_NOENT    2
+#define NFSERR_IO       5
 #define NFSERR_ACCES    13
 #define NFSERR_ISDIR    21
 #define NFSERR_INVAL    22
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.