diff options
author | 2025-02-05 12:51:26 -0700 | |
---|---|---|
committer | 2025-02-17 05:34:45 -0700 | |
commit | e855b9138470da9c1d2fe340acf653bd2af03922 (patch) | |
tree | 72ec025ef6bd4f135b0380c38e5ce1f8fe04a3ec | |
parent | io_uring/cancel: add generic remove_all helper (diff) | |
download | wireguard-linux-e855b9138470da9c1d2fe340acf653bd2af03922.tar.xz wireguard-linux-e855b9138470da9c1d2fe340acf653bd2af03922.zip |
io_uring/futex: 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/futex.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/io_uring/futex.c b/io_uring/futex.c index 43e2143255f5..47b8c229a2e3 100644 --- a/io_uring/futex.c +++ b/io_uring/futex.c @@ -90,7 +90,7 @@ static bool io_futexv_claim(struct io_futex *iof) return true; } -static bool __io_futex_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) +static bool __io_futex_cancel(struct io_kiocb *req) { /* futex wake already done or in progress */ if (req->opcode == IORING_OP_FUTEX_WAIT) { @@ -128,7 +128,7 @@ int io_futex_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_futex_cancel(ctx, req)) + if (__io_futex_cancel(req)) nr++; if (!(cd->flags & IORING_ASYNC_CANCEL_ALL)) break; @@ -144,21 +144,7 @@ int io_futex_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, bool io_futex_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->futex_list, hash_node) { - if (!io_match_task_safe(req, tctx, cancel_all)) - continue; - hlist_del_init(&req->hash_node); - __io_futex_cancel(ctx, req); - found = true; - } - - return found; + return io_cancel_remove_all(ctx, tctx, &ctx->futex_list, cancel_all, __io_futex_cancel); } int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) |