Skip to content

Commit

Permalink
io_uring: cancel-match based on flags
Browse files Browse the repository at this point in the history
Instead of going into request internals, like checking req->file->f_op,
do match them based on REQ_F_INFLIGHT, it's set only when we want it to
be reliably cancelled.

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 f012725 commit b05a1bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ enum {

/* fail rest of links */
REQ_F_FAIL_LINK = BIT(REQ_F_FAIL_LINK_BIT),
/* on inflight list */
/* on inflight list, should be cancelled and waited on exit reliably */
REQ_F_INFLIGHT = BIT(REQ_F_INFLIGHT_BIT),
/* read/write uses file position */
REQ_F_CUR_POS = BIT(REQ_F_CUR_POS_BIT),
Expand Down Expand Up @@ -1069,7 +1069,7 @@ static bool io_match_task(struct io_kiocb *head,
return true;

io_for_each_link(req, head) {
if (req->file && req->file->f_op == &io_uring_fops)
if (req->flags & REQ_F_INFLIGHT)
return true;
if (req->task->files == files)
return true;
Expand Down

0 comments on commit b05a1bc

Please sign in to comment.