aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2021-11-04 09:49:40 -0400
committerBrian Behlendorf <[email protected]>2022-08-02 10:05:14 -0700
commit035ee628cfc698c9d0f52a56565f2b70ac0dadc9 (patch)
tree047578ef57b8c28e80150d1ea644d1c788246658 /module
parent5c56591b57bd4540cdab4cd02d7c07f8544ca967 (diff)
Revert behavior of 59eab109 on not-Linux
It turns out that short-circuiting the EFAULT behavior on a short read breaks things on FreeBSD. So until there's a nicer solution, let's just revert the behavior for not-Linux. Reference: https://reviews.freebsd.org/R10:70f51f0e474ffe1fb74cb427423a2fba3637544d Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12698
Diffstat (limited to 'module')
-rw-r--r--module/zfs/zfs_vnops.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index b9e93791d..918938d62 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -261,7 +261,9 @@ zfs_read(struct znode *zp, zfs_uio_t *uio, int ioflag, cred_t *cr)
}
ASSERT(zfs_uio_offset(uio) < zp->z_size);
+#if defined(__linux__)
ssize_t start_offset = zfs_uio_offset(uio);
+#endif
ssize_t n = MIN(zfs_uio_resid(uio), zp->z_size - zfs_uio_offset(uio));
ssize_t start_resid = n;
@@ -284,13 +286,18 @@ 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 defined(__linux__)
/*
* if we actually read some bytes, bubbling EFAULT
- * up to become EAGAIN isn't what we want here.
+ * up to become EAGAIN isn't what we want here...
+ *
+ * ...on Linux, at least. On FBSD, doing this breaks.
*/
if (error == EFAULT &&
(zfs_uio_offset(uio) - start_offset) != 0)
error = 0;
+#endif
break;
}