Skip to contentSkip to conversation

9p: Fix O_NONBLOCK read behaviour in P9L_DIRECT mode

PATCH New David Howells 1 participant 1 message Jul 11, 2024

Subsystems (3)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 9p: Fix O_NONBLOCK read behaviour in P9L_DIRECT mode

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")
cc Eric Van Hensbergen <[email protected]>
cc Latchesar Ionkov <[email protected]>
cc Dominique Martinet <[email protected]>
cc Christian Schoenebeck <[email protected]>
---
 fs/9p/vfs_addr.c |    4 ++++
 1 file changed, 4 insertions(+)
fs/9p/vfs_addr.c +4 -0
index a97ceb105cd8..b443024bf715 100644
@@ -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);
 }