git: bd49a8db47dd - stable/14 - Revert "zfsctl_root_readdir: if there were no dirents to copy out, return EINVAL"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Sep 2025 04:54:35 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd49a8db47dd3a825a48f4dcf1c8684675a502c2 commit bd49a8db47dd3a825a48f4dcf1c8684675a502c2 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-09-19 17:06:54 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-09-22 04:54:00 +0000 Revert "zfsctl_root_readdir: if there were no dirents to copy out, return EINVAL" (cherry picked from commit 72924ce99c7f177db486bd2764a76bcf25892a17) --- .../openzfs/module/os/freebsd/zfs/zfs_ctldir.c | 40 ++++++++-------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c index 0c0112c29ae7..3f955b296f1e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c @@ -673,7 +673,6 @@ zfsctl_root_readdir(struct vop_readdir_args *ap) zfs_uio_t uio; int *eofp = ap->a_eofflag; off_t dots_offset; - ssize_t orig_resid; int error; zfs_uio_init(&uio, ap->a_uio); @@ -693,11 +692,13 @@ zfsctl_root_readdir(struct vop_readdir_args *ap) return (0); } - orig_resid = zfs_uio_resid(&uio); error = sfs_readdir_common(zfsvfs->z_root, ZFSCTL_INO_ROOT, ap, &uio, &dots_offset); - if (error != 0) - goto err; + if (error != 0) { + if (error == ENAMETOOLONG) /* ran out of destination space */ + error = 0; + return (error); + } if (zfs_uio_offset(&uio) != dots_offset) return (SET_ERROR(EINVAL)); @@ -710,11 +711,8 @@ zfsctl_root_readdir(struct vop_readdir_args *ap) entry.d_reclen = sizeof (entry); error = vfs_read_dirent(ap, &entry, zfs_uio_offset(&uio)); if (error != 0) { -err: - if (error == ENAMETOOLONG) { - error = orig_resid == zfs_uio_resid(&uio) ? - EINVAL : 0; - } + if (error == ENAMETOOLONG) + error = 0; return (SET_ERROR(error)); } if (eofp != NULL) @@ -1059,21 +1057,17 @@ zfsctl_snapdir_readdir(struct vop_readdir_args *ap) zfs_uio_t uio; int *eofp = ap->a_eofflag; off_t dots_offset; - ssize_t orig_resid; int error; zfs_uio_init(&uio, ap->a_uio); - orig_resid = zfs_uio_resid(&uio); ASSERT3S(vp->v_type, ==, VDIR); error = sfs_readdir_common(ZFSCTL_INO_ROOT, ZFSCTL_INO_SNAPDIR, ap, &uio, &dots_offset); if (error != 0) { - if (error == ENAMETOOLONG) { /* ran out of destination space */ - error = orig_resid == zfs_uio_resid(&uio) ? - EINVAL : 0; - } + if (error == ENAMETOOLONG) /* ran out of destination space */ + error = 0; return (error); } @@ -1091,13 +1085,9 @@ zfsctl_snapdir_readdir(struct vop_readdir_args *ap) dsl_pool_config_exit(dmu_objset_pool(zfsvfs->z_os), FTAG); if (error != 0) { if (error == ENOENT) { - if (orig_resid == zfs_uio_resid(&uio)) { - error = EINVAL; - } else { - error = 0; - if (eofp != NULL) - *eofp = 1; - } + if (eofp != NULL) + *eofp = 1; + error = 0; } zfs_exit(zfsvfs, FTAG); return (error); @@ -1110,10 +1100,8 @@ zfsctl_snapdir_readdir(struct vop_readdir_args *ap) entry.d_reclen = sizeof (entry); error = vfs_read_dirent(ap, &entry, zfs_uio_offset(&uio)); if (error != 0) { - if (error == ENAMETOOLONG) { - error = orig_resid == zfs_uio_resid(&uio) ? - EINVAL : 0; - } + if (error == ENAMETOOLONG) + error = 0; zfs_exit(zfsvfs, FTAG); return (SET_ERROR(error)); }