* [PATCH v2 5.12] io_uring: maintain CQE order of a failed link
@ 2021-03-25 19:05 Pavel Begunkov
2021-03-26 15:55 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-03-25 19:05 UTC (permalink / raw)
To: Jens Axboe, io-uring
Arguably we want CQEs of linked requests be in a strict order of
submission as it always was. Now if init of a request fails its CQE may
be posted before all prior linked requests including the head of the
link. Fix it by failing it last.
Fixes: de59bc104c24f ("io_uring: fail links more in io_submit_sqe()")
Signed-off-by: Pavel Begunkov <[email protected]>
---
v2: expand commit description
fs/io_uring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index f8df982017fa..947c9524c53a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6459,8 +6459,6 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
ret = io_init_req(ctx, req, sqe);
if (unlikely(ret)) {
fail_req:
- io_put_req(req);
- io_req_complete(req, ret);
if (link->head) {
/* fail even hard links since we don't submit */
link->head->flags |= REQ_F_FAIL_LINK;
@@ -6468,6 +6466,8 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
io_req_complete(link->head, -ECANCELED);
link->head = NULL;
}
+ io_put_req(req);
+ io_req_complete(req, ret);
return ret;
}
ret = io_req_prep(req, sqe);
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 5.12] io_uring: maintain CQE order of a failed link
2021-03-25 19:05 [PATCH v2 5.12] io_uring: maintain CQE order of a failed link Pavel Begunkov
@ 2021-03-26 15:55 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-03-26 15:55 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 3/25/21 1:05 PM, Pavel Begunkov wrote:
> Arguably we want CQEs of linked requests be in a strict order of
> submission as it always was. Now if init of a request fails its CQE may
> be posted before all prior linked requests including the head of the
> link. Fix it by failing it last.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-26 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-25 19:05 [PATCH v2 5.12] io_uring: maintain CQE order of a failed link Pavel Begunkov
2021-03-26 15:55 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox