This is a note to let you know that I've just added the patch titled io_uring: unpark SQPOLL thread for cancelation to the 5.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-unpark-sqpoll-thread-for-cancelation.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Wed Mar 10 01:03:15 PM CET 2021 From: Pavel Begunkov <asml.silence@xxxxxxxxx> Date: Wed, 10 Mar 2021 11:30:39 +0000 Subject: io_uring: unpark SQPOLL thread for cancelation To: stable@xxxxxxxxxxxxxxx Cc: Jens Axboe <axboe@xxxxxxxxx>, syzbot+695b03d82fa8e4901b06@xxxxxxxxxxxxxxxxxxxxxxxxx Message-ID: <165b3785cd6e17ffea1e53dfab027b6f89684dde.1615375332.git.asml.silence@xxxxxxxxx> From: Pavel Begunkov <asml.silence@xxxxxxxxx> commit 34343786ecc5ff493ca4d1f873b4386759ba52ee upstream We park SQPOLL task before going into io_uring_cancel_files(), so the task won't run task_works including those that might be important for the cancellation passes. In this case it's io_poll_remove_one(), which frees requests via io_put_req_deferred(). Unpark it for while waiting, it's ok as we disable submissions beforehand, so no new requests will be generated. INFO: task syz-executor893:8493 blocked for more than 143 seconds. Call Trace: context_switch kernel/sched/core.c:4327 [inline] __schedule+0x90c/0x21a0 kernel/sched/core.c:5078 schedule+0xcf/0x270 kernel/sched/core.c:5157 io_uring_cancel_files fs/io_uring.c:8912 [inline] io_uring_cancel_task_requests+0xe70/0x11a0 fs/io_uring.c:8979 __io_uring_files_cancel+0x110/0x1b0 fs/io_uring.c:9067 io_uring_files_cancel include/linux/io_uring.h:51 [inline] do_exit+0x2fe/0x2ae0 kernel/exit.c:780 do_group_exit+0x125/0x310 kernel/exit.c:922 __do_sys_exit_group kernel/exit.c:933 [inline] __se_sys_exit_group kernel/exit.c:931 [inline] __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:931 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Cc: stable@xxxxxxxxxxxxxxx # 5.5+ Reported-by: syzbot+695b03d82fa8e4901b06@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8955,11 +8955,16 @@ static void io_uring_cancel_files(struct break; io_uring_try_cancel_requests(ctx, task, files); + + if (ctx->sq_data) + io_sq_thread_unpark(ctx->sq_data); prepare_to_wait(&task->io_uring->wait, &wait, TASK_UNINTERRUPTIBLE); if (inflight == io_uring_count_inflight(ctx, task, files)) schedule(); finish_wait(&task->io_uring->wait, &wait); + if (ctx->sq_data) + io_sq_thread_park(ctx->sq_data); } } Patches currently in stable-queue which might be from asml.silence@xxxxxxxxx are queue-5.11/io_uring-io-wq-kill-off-now-unused-io_wq_work_no_cancel.patch queue-5.11/io_uring-get-rid-of-intermediate-ioring_op_close-stage.patch queue-5.11/io_uring-fix-inconsistent-lock-state.patch queue-5.11/fs-provide-locked-helper-variant-of-close_fd_get_file.patch queue-5.11/io_uring-io-wq-return-2-step-work-swap-scheme.patch queue-5.11/io_uring-deduplicate-core-cancellations-sequence.patch queue-5.11/io_uring-unpark-sqpoll-thread-for-cancelation.patch queue-5.11/io_uring-don-t-take-uring_lock-during-iowq-cancel.patch queue-5.11/io_uring-deduplicate-failing-task_work_add.patch