aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_vnops.c
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2021-11-04 09:49:40 -0400
committerGitHub <[email protected]>2021-11-04 07:49:40 -0600
commit05679465ace023148ca6317580a6feada53f1643 (patch)
treed3e40f38cae328132a40d84901c6f576baeb7716 /module/zfs/zfs_vnops.c
parente79b6807b8a9839dd3ced71376dc143e24949fb1 (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/zfs/zfs_vnops.c')
-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 9bd75c011..a83f0b02a 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -254,7 +254,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;
@@ -277,13 +279,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;
}