Lines Matching full:cd

33  * Returns true if the request matches the criteria outlined by 'cd'.
35 bool io_cancel_req_match(struct io_kiocb *req, struct io_cancel_data *cd) in io_cancel_req_match() argument
37 bool match_user_data = cd->flags & IORING_ASYNC_CANCEL_USERDATA; in io_cancel_req_match()
39 if (req->ctx != cd->ctx) in io_cancel_req_match()
42 if (!(cd->flags & (IORING_ASYNC_CANCEL_FD | IORING_ASYNC_CANCEL_OP))) in io_cancel_req_match()
45 if (cd->flags & IORING_ASYNC_CANCEL_ANY) in io_cancel_req_match()
47 if (cd->flags & IORING_ASYNC_CANCEL_FD) { in io_cancel_req_match()
48 if (req->file != cd->file) in io_cancel_req_match()
51 if (cd->flags & IORING_ASYNC_CANCEL_OP) { in io_cancel_req_match()
52 if (req->opcode != cd->opcode) in io_cancel_req_match()
55 if (match_user_data && req->cqe.user_data != cd->data) in io_cancel_req_match()
57 if (cd->flags & IORING_ASYNC_CANCEL_ALL) { in io_cancel_req_match()
59 if (cd->seq == req->work.cancel_seq) in io_cancel_req_match()
61 req->work.cancel_seq = cd->seq; in io_cancel_req_match()
70 struct io_cancel_data *cd = data; in io_cancel_cb() local
72 return io_cancel_req_match(req, cd); in io_cancel_cb()
76 struct io_cancel_data *cd) in io_async_cancel_one() argument
85 all = cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY); in io_async_cancel_one()
86 cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, cd, all); in io_async_cancel_one()
102 int io_try_cancel(struct io_uring_task *tctx, struct io_cancel_data *cd, in io_try_cancel() argument
105 struct io_ring_ctx *ctx = cd->ctx; in io_try_cancel()
110 ret = io_async_cancel_one(tctx, cd); in io_try_cancel()
118 ret = io_poll_cancel(ctx, cd, issue_flags); in io_try_cancel()
123 if (!(cd->flags & IORING_ASYNC_CANCEL_FD)) in io_try_cancel()
124 ret = io_timeout_cancel(ctx, cd); in io_try_cancel()
156 static int __io_async_cancel(struct io_cancel_data *cd, in __io_async_cancel() argument
160 bool all = cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY); in __io_async_cancel()
161 struct io_ring_ctx *ctx = cd->ctx; in __io_async_cancel()
166 ret = io_try_cancel(tctx, cd, issue_flags); in __io_async_cancel()
180 ret = io_async_cancel_one(tctx, cd); in __io_async_cancel()
194 struct io_cancel_data cd = { in io_async_cancel() local
204 if (cd.flags & IORING_ASYNC_CANCEL_FD) { in io_async_cancel()
206 cd.flags & IORING_ASYNC_CANCEL_FD_FIXED) { in io_async_cancel()
217 cd.file = req->file; in io_async_cancel()
220 ret = __io_async_cancel(&cd, tctx, issue_flags); in io_async_cancel()
239 struct io_cancel_data *cd, int fd) in __io_sync_cancel() argument
241 struct io_ring_ctx *ctx = cd->ctx; in __io_sync_cancel()
244 if ((cd->flags & IORING_ASYNC_CANCEL_FD) && in __io_sync_cancel()
245 (cd->flags & IORING_ASYNC_CANCEL_FD_FIXED)) { in __io_sync_cancel()
249 cd->file = io_file_from_index(&ctx->file_table, fd); in __io_sync_cancel()
250 if (!cd->file) in __io_sync_cancel()
254 return __io_async_cancel(cd, tctx, 0); in __io_sync_cancel()
260 struct io_cancel_data cd = { in io_sync_cancel() local
281 cd.data = sc.addr; in io_sync_cancel()
282 cd.flags = sc.flags; in io_sync_cancel()
283 cd.opcode = sc.opcode; in io_sync_cancel()
286 if ((cd.flags & IORING_ASYNC_CANCEL_FD) && in io_sync_cancel()
287 !(cd.flags & IORING_ASYNC_CANCEL_FD_FIXED)) { in io_sync_cancel()
291 cd.file = file; in io_sync_cancel()
294 ret = __io_sync_cancel(current->io_uring, &cd, sc.fd); in io_sync_cancel()
314 cd.seq = atomic_inc_return(&ctx->cancel_seq); in io_sync_cancel()
318 ret = __io_sync_cancel(current->io_uring, &cd, sc.fd); in io_sync_cancel()