Skip to content

Commit 2b35b8b

Browse files
committed
io_uring/waitid: always remove waitid entry for cancel all
We know the request is either being removed, or already in the process of being removed through task_work, so we can delete it from our waitid list upfront. This is important for remove all conditions, as we otherwise will find it multiple times and prevent cancelation progress. Remove the dead check in cancelation as well for the hash_node being empty or not. We already have a waitid reference check for ownership, so we don't need to check the list too. Cc: stable@vger.kernel.org Fixes: f31ecf6 ("io_uring: add IORING_OP_WAITID support") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 30dab60 commit 2b35b8b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

io_uring/waitid.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ static void io_waitid_complete(struct io_kiocb *req, int ret)
125125

126126
lockdep_assert_held(&req->ctx->uring_lock);
127127

128-
/*
129-
* Did cancel find it meanwhile?
130-
*/
131-
if (hlist_unhashed(&req->hash_node))
132-
return;
133-
134128
hlist_del_init(&req->hash_node);
135129

136130
ret = io_waitid_finish(req, ret);
@@ -202,6 +196,7 @@ bool io_waitid_remove_all(struct io_ring_ctx *ctx, struct task_struct *task,
202196
hlist_for_each_entry_safe(req, tmp, &ctx->waitid_list, hash_node) {
203197
if (!io_match_task_safe(req, task, cancel_all))
204198
continue;
199+
hlist_del_init(&req->hash_node);
205200
__io_waitid_cancel(ctx, req);
206201
found = true;
207202
}

0 commit comments

Comments
 (0)