Skip to content

Commit

Permalink
io_uring/cancel: fix sequence matching for IORING_ASYNC_CANCEL_ANY
Browse files Browse the repository at this point in the history
We always need to check/update the cancel sequence if
IORING_ASYNC_CANCEL_ALL is set. Also kill the redundant check for
IORING_ASYNC_CANCEL_ANY at the end, if we get here we know it's
not set as we would've matched it higher up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Jul 17, 2023
1 parent aa5cd11 commit 3a372b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions io_uring/cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ bool io_cancel_req_match(struct io_kiocb *req, struct io_cancel_data *cd)
if (req->ctx != cd->ctx)
return false;
if (cd->flags & IORING_ASYNC_CANCEL_ANY) {
;
goto check_seq;
} else if (cd->flags & IORING_ASYNC_CANCEL_FD) {
if (req->file != cd->file)
return false;
} else {
if (req->cqe.user_data != cd->data)
return false;
}
if (cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY)) {
if (cd->flags & IORING_ASYNC_CANCEL_ALL) {
check_seq:
if (cd->seq == req->work.cancel_seq)
return false;
req->work.cancel_seq = cd->seq;
Expand Down

0 comments on commit 3a372b6

Please sign in to comment.