]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: don't iopoll from io_ring_ctx_wait_and_kill()
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 16 Oct 2022 20:30:51 +0000 (21:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:17:25 +0000 (18:17 +0100)
[ Upstream commit 02bac94bd8efd75f615ac7515dd2def75b43e5b9 ]

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 <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7c03cc91455c4a1af49c6b9cbda4e57ea467aa11.1665891182.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/io_uring.c

index c5dd483a7de2fc68b9a5a18a2c6c8b646baeb364..d29f397f095eedd5932e3c15a1189ef89ef8faf6 100644 (file)
@@ -2653,15 +2653,12 @@ static __cold void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
                io_poll_remove_all(ctx, NULL, true);
        mutex_unlock(&ctx->uring_lock);
 
-       /* failed during ring init, it couldn't have issued any requests */
-       if (ctx->rings) {
+       /*
+        * If we failed setting up the ctx, we might not have any rings
+        * and therefore did not submit any requests
+        */
+       if (ctx->rings)
                io_kill_timeouts(ctx, NULL, true);
-               /* if we failed setting up the ctx, we might not have any rings */
-               io_iopoll_try_reap_events(ctx);
-               /* drop cached put refs after potentially doing completions */
-               if (current->io_uring)
-                       io_uring_drop_tctx_refs(current);
-       }
 
        INIT_WORK(&ctx->exit_work, io_ring_exit_work);
        /*