diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-02-27 11:16:46 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-03-04 06:36:22 -0700 |
commit | 8452d4a674b0e59bd53baef0b30b018690dde594 (patch) | |
tree | edd3c27ff43af17f22f8a52f507795f8966b5465 /include | |
parent | ef8eaa4e65facb1f51a64dbb4f5500134622c67c (diff) | |
download | linux-stable-8452d4a674b0e59bd53baef0b30b018690dde594.tar.gz linux-stable-8452d4a674b0e59bd53baef0b30b018690dde594.tar.bz2 linux-stable-8452d4a674b0e59bd53baef0b30b018690dde594.zip |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/io_uring.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h index 51ede771cd99..7cb7bd0e334c 100644 --- a/include/linux/io_uring.h +++ b/include/linux/io_uring.h @@ -38,7 +38,7 @@ void __io_uring_free(struct task_struct *tsk); static inline void io_uring_task_cancel(void) { - if (current->io_uring && !xa_empty(¤t->io_uring->xa)) + if (current->io_uring) __io_uring_task_cancel(); } static inline void io_uring_files_cancel(struct files_struct *files) |