diff options
author | 2025-02-05 12:52:46 -0700 | |
---|---|---|
committer | 2025-02-17 05:34:45 -0700 | |
commit | 7d9944f5061e49cab5ee0e1c9507c2e8f94d41b8 (patch) | |
tree | 80edb3b8710ea5046be12c53d29a2474c0b2b4be | |
parent | io_uring/futex: convert to io_cancel_remove_all() (diff) | |
download | wireguard-linux-7d9944f5061e49cab5ee0e1c9507c2e8f94d41b8.tar.xz wireguard-linux-7d9944f5061e49cab5ee0e1c9507c2e8f94d41b8.zip |
io_uring/waitid: convert to io_cancel_remove_all()
Use the generic helper for cancelations.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | io_uring/waitid.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/io_uring/waitid.c b/io_uring/waitid.c index 15a7daf3ff4f..87d19710d68a 100644 --- a/io_uring/waitid.c +++ b/io_uring/waitid.c @@ -132,7 +132,7 @@ static void io_waitid_complete(struct io_kiocb *req, int ret) io_req_set_res(req, ret, 0); } -static bool __io_waitid_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) +static bool __io_waitid_cancel(struct io_kiocb *req) { struct io_waitid *iw = io_kiocb_to_cmd(req, struct io_waitid); struct io_waitid_async *iwa = req->async_data; @@ -170,7 +170,7 @@ int io_waitid_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, if (req->cqe.user_data != cd->data && !(cd->flags & IORING_ASYNC_CANCEL_ANY)) continue; - if (__io_waitid_cancel(ctx, req)) + if (__io_waitid_cancel(req)) nr++; if (!(cd->flags & IORING_ASYNC_CANCEL_ALL)) break; @@ -186,21 +186,7 @@ int io_waitid_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, bool io_waitid_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx, bool cancel_all) { - struct hlist_node *tmp; - struct io_kiocb *req; - bool found = false; - - lockdep_assert_held(&ctx->uring_lock); - - hlist_for_each_entry_safe(req, tmp, &ctx->waitid_list, hash_node) { - if (!io_match_task_safe(req, tctx, cancel_all)) - continue; - hlist_del_init(&req->hash_node); - __io_waitid_cancel(ctx, req); - found = true; - } - - return found; + return io_cancel_remove_all(ctx, tctx, &ctx->waitid_list, cancel_all, __io_waitid_cancel); } static inline bool io_waitid_drop_issue_ref(struct io_kiocb *req) |