git: 70f51f0e474f - main - Revert "Handle partial reads in zfs_read"

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 22 Oct 2021 19:20:34 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=70f51f0e474ffe1fb74cb427423a2fba3637544d

commit 70f51f0e474ffe1fb74cb427423a2fba3637544d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-10-22 18:55:14 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-10-22 19:16:42 +0000

    Revert "Handle partial reads in zfs_read"
    
    This reverts commit 59eab1093a361ca76849ca76b2ec079c8736e8e3.
    
    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
---
 sys/contrib/openzfs/module/zfs/zfs_vnops.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sys/contrib/openzfs/module/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/zfs/zfs_vnops.c
index 9bd75c011ef9..8229bc9a93e5 100644
--- a/sys/contrib/openzfs/module/zfs/zfs_vnops.c
+++ b/sys/contrib/openzfs/module/zfs/zfs_vnops.c
@@ -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;
 		}