diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-11-03 10:22:43 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-11-06 13:55:38 -0700 |
commit | f03baece08188f2e239c0ca0c098c14c71739ffb (patch) | |
tree | e4822f2413609cb1b81bb226abdcaef8dd20ca17 /io_uring/timeout.c | |
parent | 6f94cbc29adacc15007c5a16295052e674099282 (diff) |
io_uring: move cancelations to be io_uring_task based
Right now the task_struct pointer is used as the key to match a task,
but in preparation for some io_kiocb changes, move it to using struct
io_uring_task instead. No functional changes intended in this patch.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/timeout.c')
-rw-r--r-- | io_uring/timeout.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/io_uring/timeout.c b/io_uring/timeout.c index 9973876d91b0..18286cb53a69 100644 --- a/io_uring/timeout.c +++ b/io_uring/timeout.c @@ -637,13 +637,13 @@ void io_queue_linked_timeout(struct io_kiocb *req) io_put_req(req); } -static bool io_match_task(struct io_kiocb *head, struct task_struct *task, +static bool io_match_task(struct io_kiocb *head, struct io_uring_task *tctx, bool cancel_all) __must_hold(&head->ctx->timeout_lock) { struct io_kiocb *req; - if (task && head->task != task) + if (tctx && head->task->io_uring != tctx) return false; if (cancel_all) return true; @@ -656,7 +656,7 @@ static bool io_match_task(struct io_kiocb *head, struct task_struct *task, } /* Returns true if we found and killed one or more timeouts */ -__cold bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, +__cold bool io_kill_timeouts(struct io_ring_ctx *ctx, struct io_uring_task *tctx, bool cancel_all) { struct io_timeout *timeout, *tmp; @@ -671,7 +671,7 @@ __cold bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, list_for_each_entry_safe(timeout, tmp, &ctx->timeout_list, list) { struct io_kiocb *req = cmd_to_io_kiocb(timeout); - if (io_match_task(req, tsk, cancel_all) && + if (io_match_task(req, tctx, cancel_all) && io_kill_timeout(req, -ECANCELED)) canceled++; } |