Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+1 -23
+1 -23
io_uring/waitid.c
··· 158 158 int io_waitid_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, 159 159 unsigned int issue_flags) 160 160 { 161 - struct hlist_node *tmp; 162 - struct io_kiocb *req; 163 - int nr = 0; 164 - 165 - if (cd->flags & (IORING_ASYNC_CANCEL_FD|IORING_ASYNC_CANCEL_FD_FIXED)) 166 - return -ENOENT; 167 - 168 - io_ring_submit_lock(ctx, issue_flags); 169 - hlist_for_each_entry_safe(req, tmp, &ctx->waitid_list, hash_node) { 170 - if (req->cqe.user_data != cd->data && 171 - !(cd->flags & IORING_ASYNC_CANCEL_ANY)) 172 - continue; 173 - if (__io_waitid_cancel(req)) 174 - nr++; 175 - if (!(cd->flags & IORING_ASYNC_CANCEL_ALL)) 176 - break; 177 - } 178 - io_ring_submit_unlock(ctx, issue_flags); 179 - 180 - if (nr) 181 - return nr; 182 - 183 - return -ENOENT; 161 + return io_cancel_remove(ctx, cd, issue_flags, &ctx->waitid_list, __io_waitid_cancel); 184 162 } 185 163 186 164 bool io_waitid_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,