mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-05 20:24:09 +08:00
io_uring: io_fail_links() should only consider first linked timeout
We currently clear the linked timeout field if we cancel such a timeout, but we should only attempt to cancel if it's the first one we see. Others should simply be freed like other requests, as they haven't been started yet. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
09fbb0a83e
commit
5d960724b0
@ -942,12 +942,12 @@ static void io_fail_links(struct io_kiocb *req)
|
|||||||
if ((req->flags & REQ_F_LINK_TIMEOUT) &&
|
if ((req->flags & REQ_F_LINK_TIMEOUT) &&
|
||||||
link->submit.sqe->opcode == IORING_OP_LINK_TIMEOUT) {
|
link->submit.sqe->opcode == IORING_OP_LINK_TIMEOUT) {
|
||||||
io_link_cancel_timeout(link);
|
io_link_cancel_timeout(link);
|
||||||
req->flags &= ~REQ_F_LINK_TIMEOUT;
|
|
||||||
} else {
|
} else {
|
||||||
io_cqring_fill_event(link, -ECANCELED);
|
io_cqring_fill_event(link, -ECANCELED);
|
||||||
__io_double_put_req(link);
|
__io_double_put_req(link);
|
||||||
}
|
}
|
||||||
kfree(sqe_to_free);
|
kfree(sqe_to_free);
|
||||||
|
req->flags &= ~REQ_F_LINK_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_commit_cqring(ctx);
|
io_commit_cqring(ctx);
|
||||||
@ -2837,9 +2837,10 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer)
|
|||||||
*/
|
*/
|
||||||
if (!list_empty(&req->list)) {
|
if (!list_empty(&req->list)) {
|
||||||
prev = list_entry(req->list.prev, struct io_kiocb, link_list);
|
prev = list_entry(req->list.prev, struct io_kiocb, link_list);
|
||||||
if (refcount_inc_not_zero(&prev->refs))
|
if (refcount_inc_not_zero(&prev->refs)) {
|
||||||
list_del_init(&req->list);
|
list_del_init(&req->list);
|
||||||
else
|
prev->flags &= ~REQ_F_LINK_TIMEOUT;
|
||||||
|
} else
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user