Skip to content

Commit 02bac94

Browse files
isilenceaxboe
authored andcommitted
io_uring: don't iopoll from io_ring_ctx_wait_and_kill()
We should not be completing requests from a task context that has already undergone io_uring cancellations, i.e. __io_uring_cancel(), as there are some assumptions, e.g. around cached task refs draining. Remove iopolling from io_ring_ctx_wait_and_kill() as it can be called later after PF_EXITING is set with the last task_work run. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/7c03cc91455c4a1af49c6b9cbda4e57ea467aa11.1665891182.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 34f0bc4 commit 02bac94

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

io_uring/io_uring.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,15 +2804,12 @@ static __cold void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
28042804
io_poll_remove_all(ctx, NULL, true);
28052805
mutex_unlock(&ctx->uring_lock);
28062806

2807-
/* failed during ring init, it couldn't have issued any requests */
2808-
if (ctx->rings) {
2807+
/*
2808+
* If we failed setting up the ctx, we might not have any rings
2809+
* and therefore did not submit any requests
2810+
*/
2811+
if (ctx->rings)
28092812
io_kill_timeouts(ctx, NULL, true);
2810-
/* if we failed setting up the ctx, we might not have any rings */
2811-
io_iopoll_try_reap_events(ctx);
2812-
/* drop cached put refs after potentially doing completions */
2813-
if (current->io_uring)
2814-
io_uring_drop_tctx_refs(current);
2815-
}
28162813

28172814
INIT_WORK(&ctx->exit_work, io_ring_exit_work);
28182815
/*

0 commit comments

Comments
 (0)