io_uring: fix sqpoll cancellation via task_work
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 15 Mar 2021 14:23:08 +0000 (14:23 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 15 Mar 2021 15:32:40 +0000 (09:32 -0600)
commitb7f5a0bfe2061b2c7b2164de06fa4072d7373a45
tree2ad3c494d8f86a89c2d3ec30db5852df025c1cd8
parent9b46571142e47503ed4f3ae3be5ed3968d8cb9cc
io_uring: fix sqpoll cancellation via task_work

Running sqpoll cancellations via task_work_run() is a bad idea because
it depends on other task works to be run, but those may be locked in
currently running task_work_run() because of how it's (splicing the list
in batches).

Enqueue and run them through a separate callback head, namely
struct io_sq_data::park_task_work. As a nice bonus we now precisely
control where it's run, that's much safer than guessing where it can
happen as it was before.

Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c