linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: dhowells@redhat.com
Cc: linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org,
	xiubli@redhat.com, idryomov@gmail.com
Subject: [PATCH 1/4] netfs: fix sense of DIO test on short read
Date: Wed, 18 May 2022 11:11:08 -0400	[thread overview]
Message-ID: <20220518151111.79735-2-jlayton@kernel.org> (raw)
In-Reply-To: <20220518151111.79735-1-jlayton@kernel.org>

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 --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;
 		}
-- 
2.36.1


  reply	other threads:[~2022-05-18 15:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 15:11 [PATCH 0/4] ceph: convert to netfs_direct_read_iter for DIO reads Jeff Layton
2022-05-18 15:11 ` Jeff Layton [this message]
2022-05-18 15:11 ` [PATCH 2/4] ceph: Use the provided iterator in ceph_netfs_issue_op() Jeff Layton
2022-05-18 15:11 ` [PATCH 3/4] ceph: enhance dout messages in issue_read codepaths Jeff Layton
2022-05-18 15:11 ` [PATCH 4/4] ceph: switch to netfs_direct_read_iter Jeff Layton
2022-05-24  2:42 ` [PATCH 0/4] ceph: convert to netfs_direct_read_iter for DIO reads Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220518151111.79735-2-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).