Skip to content

Commit

Permalink
io_uring: always lock in io_apoll_task_func
Browse files Browse the repository at this point in the history
From: Dylan Yudaken <[email protected]>

[ upstream commit c06c6c5d276707e04cedbcc55625e984922118aa ]

This is required for the failure case (io_req_complete_failed) and is
missing.

The alternative would be to only lock in the failure path, however all of
the non-error paths in io_poll_check_events that do not do not return
IOU_POLL_NO_ACTION end up locking anyway. The only extraneous lock would
be for the multishot poll overflowing the CQE ring, however multishot poll
would probably benefit from being locked as it will allow completions to
be batched.

So it seems reasonable to lock always.

Signed-off-by: Dylan Yudaken <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
isilence authored and gregkh committed Sep 19, 2023
1 parent 6ffab75 commit 208858d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions io_uring/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -5571,6 +5571,7 @@ static void io_apoll_task_func(struct io_kiocb *req, bool *locked)
if (ret > 0)
return;

io_tw_lock(req->ctx, locked);
io_poll_remove_entries(req);
spin_lock(&ctx->completion_lock);
hash_del(&req->hash_node);
Expand Down

0 comments on commit 208858d

Please sign in to comment.