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/futex: 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/futex.c
··· 116 116 int io_futex_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, 117 117 unsigned int issue_flags) 118 118 { 119 - struct hlist_node *tmp; 120 - struct io_kiocb *req; 121 - int nr = 0; 122 - 123 - if (cd->flags & (IORING_ASYNC_CANCEL_FD|IORING_ASYNC_CANCEL_FD_FIXED)) 124 - return -ENOENT; 125 - 126 - io_ring_submit_lock(ctx, issue_flags); 127 - hlist_for_each_entry_safe(req, tmp, &ctx->futex_list, hash_node) { 128 - if (req->cqe.user_data != cd->data && 129 - !(cd->flags & IORING_ASYNC_CANCEL_ANY)) 130 - continue; 131 - if (__io_futex_cancel(req)) 132 - nr++; 133 - if (!(cd->flags & IORING_ASYNC_CANCEL_ALL)) 134 - break; 135 - } 136 - io_ring_submit_unlock(ctx, issue_flags); 137 - 138 - if (nr) 139 - return nr; 140 - 141 - return -ENOENT; 119 + return io_cancel_remove(ctx, cd, issue_flags, &ctx->futex_list, __io_futex_cancel); 142 120 } 143 121 144 122 bool io_futex_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,