Skip to content

Commit 9a17334

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix short read retries for non-reg files
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: [email protected] # 5.9+ Suggested-by: Jens Axboe <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 607ec89 commit 9a17334

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
@@ -3552,7 +3552,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
35523552

35533553
/* read it all, or we did blocking attempt. no retry. */
35543554
if (!iov_iter_count(iter) || !force_nonblock ||
3555-
(req->file->f_flags & O_NONBLOCK))
3555+
(req->file->f_flags & O_NONBLOCK) || !(req->flags & REQ_F_ISREG))
35563556
goto done;
35573557

35583558
io_size -= ret;

0 commit comments

Comments
 (0)