diff options
author | Jens Axboe <axboe@kernel.dk> | 2025-02-05 13:16:29 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-02-17 05:34:45 -0700 |
commit | 932de5e35fda2844aa258c640d198dbbce74bb8f (patch) | |
tree | b33ef551d71e739930d0907a901982e915e77f09 /io_uring/waitid.c | |
parent | 2eaa2fac4704d59f2fd07e496114c39303e54a18 (diff) |
io_uring/waitid: use generic io_cancel_remove() helper
Don't implement our own loop rolling and checking, just use the generic
helper to find and cancel requests.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/waitid.c')
-rw-r--r-- | io_uring/waitid.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/io_uring/waitid.c b/io_uring/waitid.c index 87d19710d68a..5c443e5f6d92 100644 --- a/io_uring/waitid.c +++ b/io_uring/waitid.c @@ -158,29 +158,7 @@ static bool __io_waitid_cancel(struct io_kiocb *req) int io_waitid_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, unsigned int issue_flags) { - struct hlist_node *tmp; - struct io_kiocb *req; - int nr = 0; - - if (cd->flags & (IORING_ASYNC_CANCEL_FD|IORING_ASYNC_CANCEL_FD_FIXED)) - return -ENOENT; - - io_ring_submit_lock(ctx, issue_flags); - hlist_for_each_entry_safe(req, tmp, &ctx->waitid_list, hash_node) { - if (req->cqe.user_data != cd->data && - !(cd->flags & IORING_ASYNC_CANCEL_ANY)) - continue; - if (__io_waitid_cancel(req)) - nr++; - if (!(cd->flags & IORING_ASYNC_CANCEL_ALL)) - break; - } - io_ring_submit_unlock(ctx, issue_flags); - - if (nr) - return nr; - - return -ENOENT; + return io_cancel_remove(ctx, cd, issue_flags, &ctx->waitid_list, __io_waitid_cancel); } bool io_waitid_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx, |