提交 5234d231 编写于 作者: J Jens Axboe 提交者: Joseph Qi

io_uring: io_fail_links() should only consider first linked timeout

to #26323578

commit 5d960724b0cb0d12469d1c62912e4a8c09c9fd92 upstream.

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: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 76e1b540
......@@ -947,12 +947,12 @@ static void io_fail_links(struct io_kiocb *req)
if ((req->flags & REQ_F_LINK_TIMEOUT) &&
link->submit.sqe->opcode == IORING_OP_LINK_TIMEOUT) {
io_link_cancel_timeout(link);
req->flags &= ~REQ_F_LINK_TIMEOUT;
} else {
io_cqring_fill_event(link, -ECANCELED);
__io_double_put_req(link);
}
kfree(sqe_to_free);
req->flags &= ~REQ_F_LINK_TIMEOUT;
}
io_commit_cqring(ctx);
......@@ -2839,9 +2839,10 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer)
*/
if (!list_empty(&req->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);
else
prev->flags &= ~REQ_F_LINK_TIMEOUT;
} else
prev = NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册