aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2023-05-05 22:43:55 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2023-05-22 18:56:03 +0000
commitc7f6408f482059d4fb7e5344b49a8d879da73743 (patch)
treea851c85d7f1aed34f5bc89f164e6d60b67aef589
parentf72c3ecdd86900f48adee34a8ccd958a1025d376 (diff)
downloadsrc-c7f6408f482059d4fb7e5344b49a8d879da73743.tar.gz
src-c7f6408f482059d4fb7e5344b49a8d879da73743.zip
nfsd: Fix NFSv3 Readdir/ReaddirPlus reply for large i-node numbers
If the i-node number (d_fileno) for a file on the server did not fit in 32bits, it would be truncated to the low order 32bits for the NFSv3 Readdir and ReaddirPlus RPC replies. This is no longer correct, given that ino_t is now 64bits. This patch fixes this by sending the full 64bits of d_fileno on the wire in the NFSv3 Readdir/ReaddirPlus RPC reply. PR: 271174 (cherry picked from commit 648a208ef3a171585f3446464646832f0e0ed3dc)
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index e75c238b7117..a5fcf58b3d9f 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -2260,12 +2260,12 @@ again:
if (nd->nd_flag & ND_NFSV3) {
NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
*tl++ = newnfs_true;
- *tl++ = 0;
+ txdr_hyper(dp->d_fileno, tl);
} else {
NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
*tl++ = newnfs_true;
+ *tl = txdr_unsigned(dp->d_fileno);
}
- *tl = txdr_unsigned(dp->d_fileno);
(void) nfsm_strtom(nd, dp->d_name, nlen);
if (nd->nd_flag & ND_NFSV3) {
NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
@@ -2764,8 +2764,7 @@ again:
if (nd->nd_flag & ND_NFSV3) {
NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
*tl++ = newnfs_true;
- *tl++ = 0;
- *tl = txdr_unsigned(dp->d_fileno);
+ txdr_hyper(dp->d_fileno, tl);
dirlen += nfsm_strtom(nd, dp->d_name, nlen);
NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
txdr_hyper(*cookiep, tl);