[Bug 260375] NFS server truncates directory cookies to 32-bits

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 13 Dec 2021 03:37:48 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260375

            Bug ID: 260375
           Summary: NFS server truncates directory cookies to 32-bits
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

VOP_READDIR can return a list of cookies that store seek offsets for the
directory entries returned in uio.  Each cookie is a 64-bit value, matching the
64-bit d_off field in struct dirent.  However, The NFS server truncates these
cookies to 32-bits.  It happens in both nfsrvd_readdir and nfsrvd_readdirplus. 
The relevant lines are these:

*tl++ = 0;
*tl = txdr_unsigned(*cookiep);

That works just fine for UFS, where dirent offsets correspond to byte offsets
within a densely packed array.  And it works just fine for ZFS, where dirent
offsets seem to come from a 29-bit hash function.  But it fails for the FUSE
file system I'm developing, where the dirent offset uses all 64 bits.

According to RFC-1813, the NFSv3 standard, the cookie3 data type is a uint64
variable.  I can't figure out any good reason why the NFS server should
truncate it.  It's probably just a legacy thing.  I'll try to come up with a
patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.