summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-01-21 13:01:08 +0100
committerJens Axboe <axboe@kernel.dk>2021-01-22 20:42:54 +0100
commit9a173346bd9e16ab19c7addb8862d95a5cea9feb (patch)
treeffd10ce5da523cb493941b1f11f02823af7de2ee /fs/io_uring.c
parentio_uring: fix SQPOLL IORING_OP_CLOSE cancelation state (diff)
downloadlinux-9a173346bd9e16ab19c7addb8862d95a5cea9feb.tar.xz
linux-9a173346bd9e16ab19c7addb8862d95a5cea9feb.zip
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: 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>
Diffstat (limited to '')
-rw-r--r--fs/io_uring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index e4c1cdf0325d..862113a9364f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3552,7 +3552,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
/* read it all, or we did blocking attempt. no retry. */
if (!iov_iter_count(iter) || !force_nonblock ||
- (req->file->f_flags & O_NONBLOCK))
+ (req->file->f_flags & O_NONBLOCK) || !(req->flags & REQ_F_ISREG))
goto done;
io_size -= ret;