FreeBSD: fix up EINVAL from getdirentries on .zfs
Without the change: /.zfs /.zfs/snapshot find: /.zfs: Invalid argument Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Closes #14774
This commit is contained in:
parent
d1e05c6856
commit
aef1324d59
|
@ -675,6 +675,17 @@ zfsctl_root_readdir(struct vop_readdir_args *ap)
|
||||||
|
|
||||||
ASSERT3S(vp->v_type, ==, VDIR);
|
ASSERT3S(vp->v_type, ==, VDIR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: this routine only ever emits 3 entries and does not tolerate
|
||||||
|
* being called with a buffer too small to handle all of them.
|
||||||
|
*
|
||||||
|
* The check below facilitates the idiom of repeating calls until the
|
||||||
|
* count to return is 0.
|
||||||
|
*/
|
||||||
|
if (zfs_uio_offset(&uio) == 3 * sizeof(entry)) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
error = sfs_readdir_common(zfsvfs->z_root, ZFSCTL_INO_ROOT, ap, &uio,
|
error = sfs_readdir_common(zfsvfs->z_root, ZFSCTL_INO_ROOT, ap, &uio,
|
||||||
&dots_offset);
|
&dots_offset);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
|
|
Loading…
Reference in New Issue