kernel/io_uring: cancel io_uring before task works
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 26 Jan 2021 11:17:00 +0000 (11:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Jan 2021 12:55:18 +0000 (13:55 +0100)
commit7bf3fb6243a3b153ab1854b331ec19d67a4878bb
treece9a17ae020ca7353102dfb33d3a2ce46678e34d
parent08a922a6fdf8c3eaea7f6a3beb13c6eed75994dc
kernel/io_uring: cancel io_uring before task works

[ Upstream commit b1b6b5a30dce872f500dc43f067cba8e7f86fc7d ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/file.c
kernel/exit.c