io_uring: destroy io-wq on exec
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 27 Feb 2021 11:16:46 +0000 (11:16 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 1 Mar 2021 21:56:19 +0000 (14:56 -0700)
commit2d9cf9f8de66055a204f5949807a61aec4baedb1
treea12a2ea9fb7bb72bd3f75fade66eae2a439899b2
parent9a4f64f46c1e914d7e979a57eb3e5bb3d9ffc79a
io_uring: destroy io-wq on exec

Destroy current's io-wq backend and tctx on __io_uring_task_cancel(),
aka exec(). Looks it's not strictly necessary, because it will be done
at some point when the task dies and changes of creds/files/etc. are
handled, but better to do that earlier to free io-wq and not potentially
lock previous mm and other resources for the time being.

It's safe to do because we wait for all requests of the current task to
complete, so no request will use tctx afterwards. Note, that
io_uring_files_cancel() may leave some requests for later reaping, so it
leaves tctx intact, that's ok as the task is dying anyway.

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