Skip to content

Commit

Permalink
io_uring: fix ->flags races by linked timeouts
Browse files Browse the repository at this point in the history
It's racy to modify req->flags from a not owning context, e.g. linked
timeout calling req_set_fail_links() for the master request might race
with that request setting/clearing flags while being executed
concurrently. Just remove req_set_fail_links(prev) from
io_link_timeout_fn(), io_async_find_and_cancel() and functions down the
line take care of setting the fail bit.

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 15, 2021
1 parent 9e15c3a commit efe814a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
@@ -6197,7 +6197,6 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer)
spin_unlock_irqrestore(&ctx->completion_lock, flags);

if (prev) {
req_set_fail_links(prev);
io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME);
io_put_req_deferred(prev, 1);
} else {

0 comments on commit efe814a

Please sign in to comment.