diff mbox series

9p: Fix O_NONBLOCK read behaviour in P9L_DIRECT mode

Message ID 4058793.1720703979@warthog.procyon.org.uk (mailing list archive)
State New
Headers show
Series 9p: Fix O_NONBLOCK read behaviour in P9L_DIRECT mode | expand

Commit Message

David Howells July 11, 2024, 1:19 p.m. UTC
With the 9p filesystem, in P9L_DIRECT mode, if O_NONBLOCK is set, a read
should terminate after doing one piece of I/O.

Fixes: 80105ed2fd27 ("9p: Use netfslib read/write_iter")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218916
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Eric Van Hensbergen <ericvh@kernel.org>
cc: Latchesar Ionkov <lucho@ionkov.net>
cc: Dominique Martinet <asmadeus@codewreck.org>
cc: Christian Schoenebeck <linux_oss@crudebyte.com>
cc: v9fs@lists.linux.dev
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
---
 fs/9p/vfs_addr.c |    4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index a97ceb105cd8..b443024bf715 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -77,6 +77,10 @@  static void v9fs_issue_read(struct netfs_io_subrequest *subreq)
 	 * cache won't be on server and is zeroes */
 	__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
 
+	if ((fid->mode & P9L_DIRECT) &&
+	    test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags))
+		set_bit(NETFS_RREQ_BLOCKED, &rreq->flags);
+
 	netfs_subreq_terminated(subreq, err ?: total, false);
 }