Skip to content

Commit f5cac8b

Browse files
committed
io_uring: don't use retry based buffered reads for non-async bdev
Some block devices, like dm, bubble back -EAGAIN through the completion handler. We check for this in io_read(), but don't honor it for when we have copied the iov. Return -EAGAIN for this case before retrying, to force punt to io-wq. Fixes: bcf5a06 ("io_uring: support true async buffered reads, if file provides it") Reported-by: Zorro Lang <zlang@redhat.com> Tested-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8f3d749 commit f5cac8b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

fs/io_uring.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3130,6 +3130,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
31303130
struct iov_iter __iter, *iter = &__iter;
31313131
ssize_t io_size, ret, ret2;
31323132
size_t iov_count;
3133+
bool no_async;
31333134

31343135
if (req->io)
31353136
iter = &req->io->rw.iter;
@@ -3147,7 +3148,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
31473148
kiocb->ki_flags &= ~IOCB_NOWAIT;
31483149

31493150
/* If the file doesn't support async, just async punt */
3150-
if (force_nonblock && !io_file_supports_async(req->file, READ))
3151+
no_async = force_nonblock && !io_file_supports_async(req->file, READ);
3152+
if (no_async)
31513153
goto copy_iov;
31523154

31533155
ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count);
@@ -3191,6 +3193,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
31913193
ret = ret2;
31923194
goto out_free;
31933195
}
3196+
if (no_async)
3197+
return -EAGAIN;
31943198
/* it's copied and will be cleaned with ->io */
31953199
iovec = NULL;
31963200
/* now use our persistent iterator, if we aren't already */

0 commit comments

Comments
 (0)