Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 2021 23:13:17 +0000
From:      bugzilla-noreply@freebsd.org
To:        fs@FreeBSD.org
Subject:   [Bug 253428] getdirentries does not work correctly on NFS mounts
Message-ID:  <bug-253428-3630-2HrcoSLnVv@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-253428-3630@https.bugs.freebsd.org/bugzilla/>
References:  <bug-253428-3630@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253428

--- Comment #1 from Rick Macklem <rmacklem@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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253428-3630-2HrcoSLnVv>