Skip to content

Commit 52cbee2

Browse files
l29ahDominique Martinet
authored andcommitted
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/[email protected] Signed-off-by: Sergey Alirzaev <[email protected]> Signed-off-by: Dominique Martinet <[email protected]>
1 parent 388f696 commit 52cbee2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/9p/vfs_file.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,10 @@ v9fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
388388
p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n",
389389
iov_iter_count(to), iocb->ki_pos);
390390

391-
ret = p9_client_read(fid, iocb->ki_pos, to, &err);
391+
if (iocb->ki_filp->f_flags & O_NONBLOCK)
392+
ret = p9_client_read_once(fid, iocb->ki_pos, to, &err);
393+
else
394+
ret = p9_client_read(fid, iocb->ki_pos, to, &err);
392395
if (!ret)
393396
return err;
394397

0 commit comments

Comments
 (0)