Lines Matching full:cd
35 * Returns true if the request matches the criteria outlined by 'cd'.
37 bool io_cancel_req_match(struct io_kiocb *req, struct io_cancel_data *cd) in io_cancel_req_match() argument
39 bool match_user_data = cd->flags & IORING_ASYNC_CANCEL_USERDATA; in io_cancel_req_match()
41 if (req->ctx != cd->ctx) in io_cancel_req_match()
44 if (!(cd->flags & (IORING_ASYNC_CANCEL_FD | IORING_ASYNC_CANCEL_OP))) in io_cancel_req_match()
47 if (cd->flags & IORING_ASYNC_CANCEL_ANY) in io_cancel_req_match()
49 if (cd->flags & IORING_ASYNC_CANCEL_FD) { in io_cancel_req_match()
50 if (req->file != cd->file) in io_cancel_req_match()
53 if (cd->flags & IORING_ASYNC_CANCEL_OP) { in io_cancel_req_match()
54 if (req->opcode != cd->opcode) in io_cancel_req_match()
57 if (match_user_data && req->cqe.user_data != cd->data) in io_cancel_req_match()
59 if (cd->flags & IORING_ASYNC_CANCEL_ALL) { in io_cancel_req_match()
61 if (io_cancel_match_sequence(req, cd->seq)) in io_cancel_req_match()
71 struct io_cancel_data *cd = data; in io_cancel_cb() local
73 return io_cancel_req_match(req, cd); in io_cancel_cb()
77 struct io_cancel_data *cd) in io_async_cancel_one() argument
86 all = cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY); in io_async_cancel_one()
87 cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, cd, all); in io_async_cancel_one()
103 int io_try_cancel(struct io_uring_task *tctx, struct io_cancel_data *cd, in io_try_cancel() argument
106 struct io_ring_ctx *ctx = cd->ctx; in io_try_cancel()
111 ret = io_async_cancel_one(tctx, cd); in io_try_cancel()
119 ret = io_poll_cancel(ctx, cd, issue_flags); in io_try_cancel()
123 ret = io_waitid_cancel(ctx, cd, issue_flags); in io_try_cancel()
127 ret = io_futex_cancel(ctx, cd, issue_flags); in io_try_cancel()
132 if (!(cd->flags & IORING_ASYNC_CANCEL_FD)) in io_try_cancel()
133 ret = io_timeout_cancel(ctx, cd); in io_try_cancel()
165 static int __io_async_cancel(struct io_cancel_data *cd, in __io_async_cancel() argument
169 bool all = cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY); in __io_async_cancel()
170 struct io_ring_ctx *ctx = cd->ctx; in __io_async_cancel()
175 ret = io_try_cancel(tctx, cd, issue_flags); in __io_async_cancel()
187 ret = io_async_cancel_one(node->task->io_uring, cd); in __io_async_cancel()
201 struct io_cancel_data cd = { in io_async_cancel() local
211 if (cd.flags & IORING_ASYNC_CANCEL_FD) { in io_async_cancel()
213 cd.flags & IORING_ASYNC_CANCEL_FD_FIXED) { in io_async_cancel()
224 cd.file = req->file; in io_async_cancel()
227 ret = __io_async_cancel(&cd, tctx, issue_flags); in io_async_cancel()
246 struct io_cancel_data *cd, int fd) in __io_sync_cancel() argument
248 struct io_ring_ctx *ctx = cd->ctx; in __io_sync_cancel()
251 if ((cd->flags & IORING_ASYNC_CANCEL_FD) && in __io_sync_cancel()
252 (cd->flags & IORING_ASYNC_CANCEL_FD_FIXED)) { in __io_sync_cancel()
256 cd->file = io_file_from_index(&ctx->file_table, fd); in __io_sync_cancel()
257 if (!cd->file) in __io_sync_cancel()
261 return __io_async_cancel(cd, tctx, 0); in __io_sync_cancel()
267 struct io_cancel_data cd = { in io_sync_cancel() local
288 cd.data = sc.addr; in io_sync_cancel()
289 cd.flags = sc.flags; in io_sync_cancel()
290 cd.opcode = sc.opcode; in io_sync_cancel()
293 if ((cd.flags & IORING_ASYNC_CANCEL_FD) && in io_sync_cancel()
294 !(cd.flags & IORING_ASYNC_CANCEL_FD_FIXED)) { in io_sync_cancel()
298 cd.file = file; in io_sync_cancel()
301 ret = __io_sync_cancel(current->io_uring, &cd, sc.fd); in io_sync_cancel()
321 cd.seq = atomic_inc_return(&ctx->cancel_seq); in io_sync_cancel()
325 ret = __io_sync_cancel(current->io_uring, &cd, sc.fd); in io_sync_cancel()