[Bug 253428] getdirentries does not work correctly on NFS mounts

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Feb 11 23:13:17 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253428

--- Comment #1 from Rick Macklem <rmacklem at FreeBSD.org> ---
I suppose the simple answer to this is "yes".

The layer in NFS below the buffer cache does know
"physical" (as returned by an NFS server) offset
cookies, but then each buffer cache block is filled
in (completely filled, which is why the full block
is always returned) with "fake" UFS directory blocks.

The d_off field could be filled in with the byte offset
within the "logical block", but that would just break
for lseek(), etc.

The only case that work is an lseek() to the beginning
of the block, because the NFS client maintains a cache
of directory offset cookies, one for each block returned.

I suppose the bug is in the man page, in that it does
not state the NFS client as an exception.

OpenBSD does not cache directory blocks in the server
and, as such, can return d_off values that are the
directory offset cookies that work on the NFS server.
I have resisted making this change for FreeBSD, becuase
it could have a major impact on performance in certain
scenarios.

The man page should probably note that only the libc
calls opendir(3) should ever use getdirentries(2)
for NFS mounts.

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


More information about the freebsd-fs mailing list