git: 932e404f12c1 - main - Revert "zfs readdir: if there were no dirents to copy out, return EINVAL same as UFS"

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 19 Sep 2025 17:11:56 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=932e404f12c172e3d4ec47dedee02da400ef8f92

commit 932e404f12c172e3d4ec47dedee02da400ef8f92
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-09-19 17:05:08 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-09-19 17:11:50 +0000

    Revert "zfs readdir: if there were no dirents to copy out, return EINVAL same as UFS"
    
    This reverts commit 9a3edc8d5dbcb896179cfa7867f961184e146a09.
    Apparently returning EINVAL is more aggressive than UFS does it, and
    this causes compatibility issues with apps that actually trigger the
    behavior.
    
    PR:     289485, 289678
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
index 8dce97baba66..411225786089 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -1698,7 +1698,6 @@ zfs_readdir(vnode_t *vp, zfs_uio_t *uio, cred_t *cr, int *eofp,
 	objset_t	*os;
 	caddr_t		outbuf;
 	size_t		bufsize;
-	ssize_t		orig_resid;
 	zap_cursor_t	zc;
 	zap_attribute_t	*zap;
 	uint_t		bytes_wanted;
@@ -1747,7 +1746,6 @@ zfs_readdir(vnode_t *vp, zfs_uio_t *uio, cred_t *cr, int *eofp,
 	error = 0;
 	os = zfsvfs->z_os;
 	offset = zfs_uio_offset(uio);
-	orig_resid = zfs_uio_resid(uio);
 	prefetch = zp->z_zn_prefetch;
 	zap = zap_attribute_long_alloc();
 
@@ -1927,7 +1925,7 @@ update:
 		kmem_free(outbuf, bufsize);
 
 	if (error == ENOENT)
-		error = orig_resid == zfs_uio_resid(uio) ? EINVAL : 0;
+		error = 0;
 
 	ZFS_ACCESSTIME_STAMP(zfsvfs, zp);