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:00 +0000 (09:32 -0600)
commit02934d39a08a57ce5226e3063b2b4e059f59c454
tree96cf8b2f3f93af66f3898e96e12085e1085e542e
parent3f62f5a7ed8b545c5aeb124e69b70964a35b655d
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