diff mbox series

[1/4] netfs: fix sense of DIO test on short read

Message ID 20220518151111.79735-2-jlayton@kernel.org
State New
Headers show
Series ceph: convert to netfs_direct_read_iter for DIO reads | expand

Commit Message

Jeff Layton May 18, 2022, 3:11 p.m. UTC
The sense of this test is reversed. There's nothing that prevents
userland from requesting a DIO read that is longer than the available
data. Conversely, we don't expect a buffered read to be short unless it
hits the EOF.

Suggested-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/netfs/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

David, feel free to fold this into the patch that adds the condition
so we can avoid the regression.
diff mbox series

Patch

diff --git a/fs/netfs/io.c b/fs/netfs/io.c
index e5a15a924fc7..8188d43e8044 100644
--- a/fs/netfs/io.c
+++ b/fs/netfs/io.c
@@ -728,7 +728,7 @@  ssize_t netfs_begin_read(struct netfs_io_request *rreq, bool sync)
 
 		ret = rreq->error;
 		if (ret == 0 && rreq->submitted < rreq->len &&
-		    rreq->origin == NETFS_DIO_READ) {
+		    rreq->origin != NETFS_DIO_READ) {
 			trace_netfs_failure(rreq, NULL, ret, netfs_fail_short_read);
 			ret = -EIO;
 		}