summaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorSergey Alirzaev <l29ah@cock.li>2020-02-05 03:34:57 +0300
committerDominique Martinet <dominique.martinet@cea.fr>2020-03-27 09:29:56 +0000
commit52cbee2a5768d1cf6051286490be43e1712674b3 (patch)
tree7e6c6c46869b9c1b64d251d3720853cfd9042f4f /fs/9p
parent388f6966b05746e80e809984231b06e93aa5d891 (diff)
downloadlinux-stable-52cbee2a5768d1cf6051286490be43e1712674b3.tar.gz
linux-stable-52cbee2a5768d1cf6051286490be43e1712674b3.tar.bz2
linux-stable-52cbee2a5768d1cf6051286490be43e1712674b3.zip
9p: read only once on O_NONBLOCK
A proper way to handle O_NONBLOCK would be making the requests and responses happen asynchronously, but this would require serious code refactoring. Link: http://lkml.kernel.org/r/20200205003457.24340-2-l29ah@cock.li Signed-off-by: Sergey Alirzaev <l29ah@cock.li> Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_file.c5
1 files changed, 4 insertions, 1 deletions
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;