HomeFreeBSD

nfsd: Fix the NFSv4 Readdir operation for an empty ZFS dir

Description

nfsd: Fix the NFSv4 Readdir operation for an empty ZFS dir

Commit 9a3edc8 modified the behaviour of ZFS's
VOP_READDIR() such that it will reply EINVAL for
an offset past EOF on the directory.

This exposed a latent bug in the NFSv4 Readdir
code, which would attempt a Readdir with an
offset beyond EOF for a directory that consists
of only "." and "..". This happened because NFSv4
does not reply "." or ".." to the client and, after
skipping over them, attempted another VOP_READDIR().

This patch fixes the problem by checking the eofflag
for the case where all entries have been skipped over.

Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D52370

(cherry picked from commit 1c52d525f06411726d7755081f904de64749eb9b)

Details

Provenance
rmacklemAuthored on Sep 4 2025, 1:48 AM
Reviewer
kib
Differential Revision
D52370: nfsd: Fix the NFSv4 Readdir operation for an empty ZFS dir
Parents
rGa2230148a649: vtnet.4: remove stray line
Branches
Unknown
Tags
Unknown