Skip to content

Commit

Permalink
io_uring: kill cached requests from exiting task closing the ring
Browse files Browse the repository at this point in the history
Be nice and prune these upfront, in case the ring is being shared and
one of the tasks is going away. This is a bit more important now that
we account the allocations.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Feb 13, 2021
1 parent 9a4fdbd commit 41be53e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -9232,8 +9232,10 @@ static int io_uring_flush(struct file *file, void *data)
struct io_uring_task *tctx = current->io_uring;
struct io_ring_ctx *ctx = file->private_data;

if (fatal_signal_pending(current) || (current->flags & PF_EXITING))
if (fatal_signal_pending(current) || (current->flags & PF_EXITING)) {
io_uring_cancel_task_requests(ctx, NULL);
io_req_caches_free(ctx, current);
}

if (!tctx)
return 0;
Expand Down

0 comments on commit 41be53e

Please sign in to comment.