Thread (6 messages) flat view 6 messages, 2 authors, 2020-02-05
STALE2418d

[PATCH 2/2] 9p: read only once on O_NONBLOCK

From: Sergey Alirzaev <hidden>
Date: 2020-02-05 00:35:48
Also in: lkml
Subsystem: 9p file system, filesystems (vfs and infrastructure), the rest · Maintainers: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet, Alexander Viro, Christian Brauner, Linus Torvalds

A proper way to handle O_NONBLOCK would be making the requests and
responses happen asynchronously, but this would require serious code
refactoring.

Signed-off-by: Sergey Alirzaev <redacted>
---
 fs/9p/vfs_file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index fe7f0bd2048e..92cd1d80218d 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -388,7 +388,10 @@ v9fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 	p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n",
 		 iov_iter_count(to), iocb->ki_pos);
 
-	ret = p9_client_read(fid, iocb->ki_pos, to, &err);
+	if (iocb->ki_filp->f_flags & O_NONBLOCK)
+		ret = p9_client_read_once(fid, iocb->ki_pos, to, &err);
+	else
+		ret = p9_client_read(fid, iocb->ki_pos, to, &err);
 	if (!ret)
 		return err;
 
-- 
2.25.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help