Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+20 -7
+13
io_uring/io_uring.c
··· 527 527 io_queue_linked_timeout(link); 528 528 } 529 529 530 + static void io_tw_requeue_iowq(struct io_kiocb *req, struct io_tw_state *ts) 531 + { 532 + req->flags &= ~REQ_F_REISSUE; 533 + io_queue_iowq(req); 534 + } 535 + 536 + void io_tw_queue_iowq(struct io_kiocb *req) 537 + { 538 + req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE; 539 + req->io_task_work.func = io_tw_requeue_iowq; 540 + io_req_task_work_add(req); 541 + } 542 + 530 543 static __cold void io_queue_deferred(struct io_ring_ctx *ctx) 531 544 { 532 545 while (!list_empty(&ctx->defer_list)) {
+1
io_uring/io_uring.h
··· 75 75 void __io_req_task_work_add(struct io_kiocb *req, unsigned flags); 76 76 bool io_alloc_async_data(struct io_kiocb *req); 77 77 void io_req_task_queue(struct io_kiocb *req); 78 + void io_tw_queue_iowq(struct io_kiocb *req); 78 79 void io_req_task_complete(struct io_kiocb *req, struct io_tw_state *ts); 79 80 void io_req_task_queue_fail(struct io_kiocb *req, int ret); 80 81 void io_req_task_submit(struct io_kiocb *req, struct io_tw_state *ts);
+6 -7
io_uring/rw.c
··· 455 455 * current cycle. 456 456 */ 457 457 io_req_io_end(req); 458 - req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE; 458 + io_tw_queue_iowq(req); 459 459 return true; 460 460 } 461 461 req_set_fail(req); ··· 521 521 io_req_end_write(req); 522 522 if (unlikely(res != req->cqe.res)) { 523 523 if (res == -EAGAIN && io_rw_should_reissue(req)) { 524 - req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE; 524 + io_tw_queue_iowq(req); 525 525 return; 526 526 } 527 527 req->cqe.res = res; ··· 839 839 ret = io_iter_do_read(rw, &io->iter); 840 840 841 841 if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) { 842 - req->flags &= ~REQ_F_REISSUE; 842 + if (req->flags & REQ_F_REISSUE) 843 + return IOU_ISSUE_SKIP_COMPLETE; 843 844 /* If we can poll, just do that. */ 844 845 if (io_file_can_poll(req)) 845 846 return -EAGAIN; ··· 1035 1034 else 1036 1035 ret2 = -EINVAL; 1037 1036 1038 - if (req->flags & REQ_F_REISSUE) { 1039 - req->flags &= ~REQ_F_REISSUE; 1040 - ret2 = -EAGAIN; 1041 - } 1037 + if (req->flags & REQ_F_REISSUE) 1038 + return IOU_ISSUE_SKIP_COMPLETE; 1042 1039 1043 1040 /* 1044 1041 * Raw bdev writes will return -EOPNOTSUPP for IOCB_NOWAIT. Just