freebsd: return EISDIR for read(2) on directories
This is arguably a change for internal consistency within OpenZFS, as the Linux implementation will reject read(2) on directories with EISDIR. It's not unreasonable for read(2) to do something here on FreeBSD, but we don't currently copy out anything useful anyways so start rejecting it with the appropriate error. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Closes #10338
This commit is contained in:
parent
d2782af461
commit
5b090d57d4
|
@ -743,6 +743,12 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr)
|
|||
ZFS_ENTER(zfsvfs);
|
||||
ZFS_VERIFY_ZP(zp);
|
||||
|
||||
/* We don't copy out anything useful for directories. */
|
||||
if (vp->v_type == VDIR) {
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (SET_ERROR(EISDIR));
|
||||
}
|
||||
|
||||
if (zp->z_pflags & ZFS_AV_QUARANTINED) {
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (SET_ERROR(EACCES));
|
||||
|
|
Loading…
Reference in New Issue