io_uring: ban tw queue for exiting processes
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 21 Apr 2022 13:44:16 +0000 (14:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 21 Apr 2022 14:38:15 +0000 (08:38 -0600)
commit47ffe5548341cc456aa46953fc92a525c39385fc
treea7155055385c57db6b4c9af7b56e1ab80817aff9
parentd155e650a96ae0d15ef6dc5970994040fe1dfcd8
io_uring: ban tw queue for exiting processes

We rely on PF_EXITING and task_work infrastructure for preventing adding
new task_work items to a dying task, which is a bit more convoluted than
desired.

Ban new tw items earlier in io_uring_cancel_generic() by relying on
->in_idle. io_req_task_work_add() will check the flag, set REQ_F_FAIL
and push requests to the fallback path. task_work handlers will find it
and cancel requests just as it was with PF_EXITING.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/4c8fc40551c5b991fc6560cba2ffe37f47375a1e.1650548192.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c