Skip to content

Commit

Permalink
io_uring: reliably cancel linked timeouts
Browse files Browse the repository at this point in the history
Linked timeouts are fired asynchronously (i.e. soft-irq), and use
generic cancellation paths to do its stuff, including poking into io-wq.
The problem is that it's racy to access tctx->io_wq, as
io_uring_task_cancel() and others may be happening at this exact moment.
Mark linked timeouts with REQ_F_INLIFGHT for now, making sure there are
no timeouts before io-wq destraction.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Mar 4, 2021
1 parent b05a1bc commit dd59a3d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -5500,6 +5500,7 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,

data->mode = io_translate_timeout_mode(flags);
hrtimer_init(&data->timer, CLOCK_MONOTONIC, data->mode);
io_req_track_inflight(req);
return 0;
}

Expand Down

0 comments on commit dd59a3d

Please sign in to comment.