git: 9a3edc8d5dbc - main - zfs readdir: if there were no dirents to copy out, return EINVAL same as UFS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 18 Aug 2025 13:30:37 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=9a3edc8d5dbcb896179cfa7867f961184e146a09
commit 9a3edc8d5dbcb896179cfa7867f961184e146a09
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-08-16 01:33:09 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-08-18 13:30:04 +0000
zfs readdir: if there were no dirents to copy out, return EINVAL same as UFS
Reviewed by: allanjude, markj, rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51930
---
sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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 6b55329da7a7..174141a5deab 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
@@ -1695,6 +1695,7 @@ 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;
@@ -1743,6 +1744,7 @@ 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();
@@ -1922,7 +1924,7 @@ update:
kmem_free(outbuf, bufsize);
if (error == ENOENT)
- error = 0;
+ error = orig_resid == zfs_uio_resid(uio) ? EINVAL : 0;
ZFS_ACCESSTIME_STAMP(zfsvfs, zp);