Revert "Handle partial reads in zfs_read"

This reverts commit 59eab1093a.

The change suppressed EFAULT originating from uiomove().  The deadlock
avoidance mechanism implemented by vn_io_fault1() in the VFS handles
such errors by wiring the user pages and retrying, but this change
caused read() to return early instead.  This can result in short I/O,
causing misbehaviour in some applications, and possibly other
consequences.

Until this is resolved somehow, revert the commit.

Approved by:	mm
This commit is contained in:
Mark Johnston 2021-10-22 14:55:14 -04:00
parent 6aae3517ed
commit 70f51f0e47

View File

@ -254,7 +254,6 @@ zfs_read(struct znode *zp, zfs_uio_t *uio, int ioflag, cred_t *cr)
}
ASSERT(zfs_uio_offset(uio) < zp->z_size);
ssize_t start_offset = zfs_uio_offset(uio);
ssize_t n = MIN(zfs_uio_resid(uio), zp->z_size - zfs_uio_offset(uio));
ssize_t start_resid = n;
@ -277,13 +276,6 @@ zfs_read(struct znode *zp, zfs_uio_t *uio, int ioflag, cred_t *cr)
/* convert checksum errors into IO errors */
if (error == ECKSUM)
error = SET_ERROR(EIO);
/*
* if we actually read some bytes, bubbling EFAULT
* up to become EAGAIN isn't what we want here.
*/
if (error == EFAULT &&
(zfs_uio_offset(uio) - start_offset) != 0)
error = 0;
break;
}