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 (cd->seq == req->work.cancel_seq) in io_cancel_req_match()
63 req->work.cancel_seq = cd->seq; in io_cancel_req_match()
72 struct io_cancel_data *cd = data; in io_cancel_cb() local
74 return io_cancel_req_match(req, cd); in io_cancel_cb()
78 struct io_cancel_data *cd) in io_async_cancel_one() argument
87 all = cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY); in io_async_cancel_one()
88 cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, cd, all); in io_async_cancel_one()
104 int io_try_cancel(struct io_uring_task *tctx, struct io_cancel_data *cd, in io_try_cancel() argument
107 struct io_ring_ctx *ctx = cd->ctx; in io_try_cancel()
112 ret = io_async_cancel_one(tctx, cd); in io_try_cancel()
120 ret = io_poll_cancel(ctx, cd, issue_flags); in io_try_cancel()
124 ret = io_waitid_cancel(ctx, cd, issue_flags); in io_try_cancel()
128 ret = io_futex_cancel(ctx, cd, issue_flags); in io_try_cancel()
133 if (!(cd->flags & IORING_ASYNC_CANCEL_FD)) in io_try_cancel()
134 ret = io_timeout_cancel(ctx, cd); in io_try_cancel()
166 static int __io_async_cancel(struct io_cancel_data *cd, in __io_async_cancel() argument
170 bool all = cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY); in __io_async_cancel()
171 struct io_ring_ctx *ctx = cd->ctx; in __io_async_cancel()
176 ret = io_try_cancel(tctx, cd, issue_flags); in __io_async_cancel()
190 ret = io_async_cancel_one(tctx, cd); in __io_async_cancel()
204 struct io_cancel_data cd = { in io_async_cancel() local
214 if (cd.flags & IORING_ASYNC_CANCEL_FD) { in io_async_cancel()
216 cd.flags & IORING_ASYNC_CANCEL_FD_FIXED) { in io_async_cancel()
227 cd.file = req->file; in io_async_cancel()
230 ret = __io_async_cancel(&cd, tctx, issue_flags); in io_async_cancel()
249 struct io_cancel_data *cd, int fd) in __io_sync_cancel() argument
251 struct io_ring_ctx *ctx = cd->ctx; in __io_sync_cancel()
254 if ((cd->flags & IORING_ASYNC_CANCEL_FD) && in __io_sync_cancel()
255 (cd->flags & IORING_ASYNC_CANCEL_FD_FIXED)) { in __io_sync_cancel()
259 cd->file = io_file_from_index(&ctx->file_table, fd); in __io_sync_cancel()
260 if (!cd->file) in __io_sync_cancel()
264 return __io_async_cancel(cd, tctx, 0); in __io_sync_cancel()
270 struct io_cancel_data cd = { in io_sync_cancel() local
291 cd.data = sc.addr; in io_sync_cancel()
292 cd.flags = sc.flags; in io_sync_cancel()
293 cd.opcode = sc.opcode; in io_sync_cancel()
296 if ((cd.flags & IORING_ASYNC_CANCEL_FD) && in io_sync_cancel()
297 !(cd.flags & IORING_ASYNC_CANCEL_FD_FIXED)) { in io_sync_cancel()
301 cd.file = file; in io_sync_cancel()
304 ret = __io_sync_cancel(current->io_uring, &cd, sc.fd); in io_sync_cancel()
324 cd.seq = atomic_inc_return(&ctx->cancel_seq); in io_sync_cancel()
328 ret = __io_sync_cancel(current->io_uring, &cd, sc.fd); in io_sync_cancel()