Replace fill_cqe insside of io_fail_links with tw. The CQE ordering guarantees rely on the fact that io_uring's tw's are executed in order. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 0e04e0997d7d..fff66f4d00c4 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2335,11 +2335,13 @@ static void io_fail_links(struct io_kiocb *req) trace_io_uring_fail_link(req->ctx, req, req->user_data, req->opcode, link); - if (!ignore_cqes) { + if (!ignore_cqes) link->flags &= ~REQ_F_CQE_SKIP; - io_fill_cqe_req(link, res, 0); - } - io_put_req_deferred(link); + /* + * linked CQEs should be ordered, we rely on the tw + * infrastructure executing them in the right order + */ + io_req_tw_queue_complete(link, res); link = nxt; } } -- 2.35.1