summaryrefslogtreecommitdiffstats
path: root/io_uring/rw.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-04-17 09:23:55 -0600
committerJens Axboe <axboe@kernel.dk>2024-04-17 09:23:55 -0600
commitdf604d2ad480fcf7b39767280c9093e13b1de952 (patch)
tree10fa5144873d57d4cfd6f56af02e40e3585b31f6 /io_uring/rw.c
parent24c3fc5c75c5b9d471783b4a4958748243828613 (diff)
downloadlinux-df604d2ad480fcf7b39767280c9093e13b1de952.tar.gz
linux-df604d2ad480fcf7b39767280c9093e13b1de952.tar.bz2
linux-df604d2ad480fcf7b39767280c9093e13b1de952.zip
io_uring/rw: ensure retry condition isn't lost
A previous commit removed the checking on whether or not it was possible to retry a request, since it's now possible to retry any of them. This would previously have caused the request to have been ended with an error, but now the retry condition can simply get lost instead. Cleanup the retry handling and always just punt it to task_work, which will queue it with io-wq appropriately. Reported-by: Changhui Zhong <czhong@redhat.com> Tested-by: Ming Lei <ming.lei@redhat.com> Fixes: cca6571381a0 ("io_uring/rw: cleanup retry path") Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rw.c')
-rw-r--r--io_uring/rw.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 3134a6ece1be..4fed829fe97c 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -455,7 +455,7 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res)
* current cycle.
*/
io_req_io_end(req);
- req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE;
+ io_tw_queue_iowq(req);
return true;
}
req_set_fail(req);
@@ -521,7 +521,7 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res)
io_req_end_write(req);
if (unlikely(res != req->cqe.res)) {
if (res == -EAGAIN && io_rw_should_reissue(req)) {
- req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE;
+ io_tw_queue_iowq(req);
return;
}
req->cqe.res = res;
@@ -839,7 +839,8 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
ret = io_iter_do_read(rw, &io->iter);
if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) {
- req->flags &= ~REQ_F_REISSUE;
+ if (req->flags & REQ_F_REISSUE)
+ return IOU_ISSUE_SKIP_COMPLETE;
/* If we can poll, just do that. */
if (io_file_can_poll(req))
return -EAGAIN;
@@ -1034,10 +1035,8 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags)
else
ret2 = -EINVAL;
- if (req->flags & REQ_F_REISSUE) {
- req->flags &= ~REQ_F_REISSUE;
- ret2 = -EAGAIN;
- }
+ if (req->flags & REQ_F_REISSUE)
+ return IOU_ISSUE_SKIP_COMPLETE;
/*
* Raw bdev writes will return -EOPNOTSUPP for IOCB_NOWAIT. Just