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
This commit is contained in:
@@ -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 @@ zfs_readdir(vnode_t *vp, zfs_uio_t *uio, cred_t *cr, int *eofp,
|
||||
kmem_free(outbuf, bufsize);
|
||||
|
||||
if (error == ENOENT)
|
||||
error = 0;
|
||||
error = orig_resid == zfs_uio_resid(uio) ? EINVAL : 0;
|
||||
|
||||
ZFS_ACCESSTIME_STAMP(zfsvfs, zp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user