Skip to content

Commit 2df15ef

Browse files
isilencegregkh
authored andcommitted
io_uring: fix short read retries for non-reg files
commit 9a17334 upstream. Sockets and other non-regular files may actually expect short reads to happen, don't retry reads for them. Because non-reg files don't set FMODE_BUF_RASYNC and so it won't do second/retry do_read, we can filter out those cases after first do_read() attempt with ret>0. Cc: stable@vger.kernel.org # 5.9+ Suggested-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f3ac7a5 commit 2df15ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3461,7 +3461,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
34613461

34623462
/* read it all, or we did blocking attempt. no retry. */
34633463
if (!iov_iter_count(iter) || !force_nonblock ||
3464-
(req->file->f_flags & O_NONBLOCK))
3464+
(req->file->f_flags & O_NONBLOCK) || !(req->flags & REQ_F_ISREG))
34653465
goto done;
34663466

34673467
io_size -= ret;

0 commit comments

Comments
 (0)