diff options
author | Jens Axboe <axboe@kernel.dk> | 2021-02-23 12:27:49 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-23 20:33:36 -0700 |
commit | 8a378fb096a7f02943c72a428bbfd0029260efb6 (patch) | |
tree | 0a734ed2b33e2e08295b5a0793bb20d72a32ad0f /fs/io_uring.c | |
parent | 0100e6bbdbb79404e56939313662b42737026574 (diff) |
io_uring: ensure io-wq context is always destroyed for tasks
If the task ends up doing no IO, the context list is empty and we don't
call into __io_uring_files_cancel() when the task exits. This can cause
a leak of the io-wq structures.
Ensure we always call __io_uring_files_cancel(), even if the task
context list is empty.
Fixes: 5aa75ed5b93f ("io_uring: tie async worker side to the task context")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index e62ad6bde569..0a435a6f265a 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8800,9 +8800,10 @@ void __io_uring_files_cancel(struct files_struct *files) if (files) { io_uring_remove_task_files(tctx); - } else if (tctx->io_wq && current->flags & PF_EXITING) { - io_wq_destroy(tctx->io_wq); - tctx->io_wq = NULL; + if (tctx->io_wq) { + io_wq_destroy(tctx->io_wq); + tctx->io_wq = NULL; + } } } |