kernel/io_uring: cancel io_uring before task works
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 30 Dec 2020 21:34:16 +0000 (21:34 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 31 Dec 2020 02:36:54 +0000 (19:36 -0700)
commitb1b6b5a30dce872f500dc43f067cba8e7f86fc7d
tree0deae7b9298a78c4f63a4fdd9924eb3ee4f5876d
parent1ffc54220c444774b7f09e6d2121e732f8e19b94
kernel/io_uring: cancel io_uring before task works

For cancelling io_uring requests it needs either to be able to run
currently enqueued task_works or having it shut down by that moment.
Otherwise io_uring_cancel_files() may be waiting for requests that won't
ever complete.

Go with the first way and do cancellations before setting PF_EXITING and
so before putting the task_work infrastructure into a transition state
where task_work_run() would better not be called.

Cc: stable@vger.kernel.org # 5.5+
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/file.c
kernel/exit.c