aboutsummaryrefslogtreecommitdiffstats
path: root/io_uring
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-09-07 09:41:49 -0600
committerJens Axboe <axboe@kernel.dk>2023-09-07 09:41:49 -0600
commit023464fe33a53d7e3fa0a1967a2adcb17e5e40e3 (patch)
tree5523525bf1d708c4d49afd85171fcffc7b35afa0 /io_uring
parent27122c079f5b4b4ecf1323b65700edc57e07bf6e (diff)
downloadlinux-023464fe33a53d7e3fa0a1967a2adcb17e5e40e3.tar.gz
Revert "io_uring: fix IO hang in io_wq_put_and_exit from do_exit()"
This reverts commit b484a40dc1f16edb58e5430105a021e1916e6f27. This commit cancels all requests with io-wq, not just the ones from the originating task. This breaks use cases that have thread pools, or just multiple tasks issuing requests on the same ring. The liburing regression test for this also shows that problem: $ test/thread-exit.t cqe->res=-125, Expected 512 where an IO thread gets its request canceled rather than complete successfully. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 090913acf1db4d..783ed0fff71b58 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3317,37 +3317,6 @@ static s64 tctx_inflight(struct io_uring_task *tctx, bool tracked)
return percpu_counter_sum(&tctx->inflight);
}
-static void io_uring_cancel_wq(struct io_uring_task *tctx)
-{
- int ret;
-
- if (!tctx->io_wq)
- return;
-
- /*
- * FIXED_FILE request isn't tracked in do_exit(), and these
- * requests may be submitted to our io_wq as iopoll, so have to
- * cancel them before destroying io_wq for avoiding IO hang
- */
- do {
- struct io_tctx_node *node;
- unsigned long index;
-
- ret = 0;
- xa_for_each(&tctx->xa, index, node) {
- struct io_ring_ctx *ctx = node->ctx;
- struct io_task_cancel cancel = { .task = current, .all = true, };
- enum io_wq_cancel cret;
-
- io_iopoll_try_reap_events(ctx);
- cret = io_wq_cancel_cb(tctx->io_wq, io_cancel_task_cb,
- &cancel, true);
- ret |= (cret != IO_WQ_CANCEL_NOTFOUND);
- cond_resched();
- }
- } while (ret);
-}
-
/*
* Find any io_uring ctx that this task has registered or done IO on, and cancel
* requests. @sqd should be not-null IFF it's an SQPOLL thread cancellation.
@@ -3419,7 +3388,6 @@ end_wait:
finish_wait(&tctx->wait, &wait);
} while (1);
- io_uring_cancel_wq(tctx);
io_uring_clean_tctx(tctx);
if (cancel_all) {
/*