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 17:10:30 +0000 (10:10 -0700)
commit38329c0d02511e9aac8665cd42bbb6fb7e034a7c
treef8db1b097b85f03f9314400c5f166314077a5942
parente8cb476e20ef29017a6156cdd720293c7580a6dd
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