Pavel Begunkov 713b9825a4 io-wq: fix cancellation on create-worker failure
WARNING: CPU: 0 PID: 10392 at fs/io_uring.c:1151 req_ref_put_and_test
fs/io_uring.c:1151 [inline]
WARNING: CPU: 0 PID: 10392 at fs/io_uring.c:1151 req_ref_put_and_test
fs/io_uring.c:1146 [inline]
WARNING: CPU: 0 PID: 10392 at fs/io_uring.c:1151
io_req_complete_post+0xf5b/0x1190 fs/io_uring.c:1794
Modules linked in:
Call Trace:
 tctx_task_work+0x1e5/0x570 fs/io_uring.c:2158
 task_work_run+0xe0/0x1a0 kernel/task_work.c:164
 tracehook_notify_signal include/linux/tracehook.h:212 [inline]
 handle_signal_work kernel/entry/common.c:146 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
 exit_to_user_mode_prepare+0x232/0x2a0 kernel/entry/common.c:209
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae

When io_wqe_enqueue() -> io_wqe_create_worker() fails, we can't just
call io_run_cancel() to clean up the request, it's already enqueued via
io_wqe_insert_work() and will be executed either by some other worker
during cancellation (e.g. in io_wq_put_and_exit()).

Reported-by: Hao Sun <sunhao.th@gmail.com>
Fixes: 3146cba99aa28 ("io-wq: make worker creation resilient against signals")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/93b9de0fcf657affab0acfd675d4abcd273ee863.1631092071.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-09-08 06:34:57 -06:00
..
2021-09-02 09:21:27 -07:00
2021-08-19 09:02:55 +09:00
2021-09-02 09:21:27 -07:00
2021-09-02 09:21:27 -07:00
2021-04-12 15:04:29 +02:00
2021-09-02 09:21:27 -07:00
2021-07-06 11:06:04 -07:00
2021-09-02 09:21:27 -07:00
2021-09-04 10:48:47 -07:00
2021-09-02 12:32:12 -07:00
2021-09-07 12:18:29 -07:00
2021-09-02 09:21:27 -07:00
2021-09-04 10:25:26 -07:00
2021-09-04 10:25:26 -07:00
2021-07-06 20:14:41 -04:00
2021-09-02 15:09:46 -07:00
\n
2021-08-30 10:04:31 -07:00
2021-08-18 22:08:24 +02:00
2021-09-03 18:42:01 +02:00
2021-06-30 12:21:16 -07:00
2021-06-29 10:53:48 -07:00
2021-09-03 15:33:47 -07:00
2021-08-16 10:50:32 -06:00
2021-08-19 09:02:55 +09:00
2021-09-02 09:21:27 -07:00
\n
2021-08-30 10:24:50 -07:00
2021-08-30 19:30:30 -07:00
2021-08-31 11:13:35 -07:00
2021-08-31 12:00:07 -07:00
2021-08-31 11:13:35 -07:00
2021-09-06 09:26:07 -07:00
2021-08-31 11:06:32 -07:00
2021-06-29 10:53:48 -07:00
2021-08-18 22:08:24 +02:00
2021-02-21 11:02:48 -08:00
2021-02-13 17:17:53 +01:00
2021-08-10 17:57:22 +02:00