Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 May 2023 22:45:23 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 648a208ef3a1 - main - nfsd: Fix NFSv3 Readdir/ReaddirPlus reply for large i-node numbers
Message-ID:  <202305052245.345MjNlD037957@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=648a208ef3a171585f3446464646832f0e0ed3dc

commit 648a208ef3a171585f3446464646832f0e0ed3dc
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-05-05 22:43:55 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-05-05 22:43:55 +0000

    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
    Reported by:    bmueller@panasas.com
    Tested by:      bmueller@panasas.com
    MFC after:      2 weeks
---
 sys/fs/nfsserver/nfs_nfsdport.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 56f5c00d0aed..6b5f357ecaf9 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -2251,12 +2251,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);
@@ -2753,8 +2753,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305052245.345MjNlD037957>