diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-02-18 19:29:43 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-18 21:13:18 +0100 |
commit | cf109604265156bb22c45e0c2aa62f53a697a3f4 (patch) | |
tree | 466a8dd84c4edcd1c2ab18cb68ab408038a7ab49 /fs/io_uring.c | |
parent | io_uring: move req link into submit_state (diff) | |
download | linux-cf109604265156bb22c45e0c2aa62f53a697a3f4.tar.xz linux-cf109604265156bb22c45e0c2aa62f53a697a3f4.zip |
io_uring: don't submit link on error
If we get an error in io_init_req() for a request that would have been
linked, we break the submission but still issue a partially composed
link, that's nasty, fail it instead.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | fs/io_uring.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index fe2379179b00..62688866357c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6763,6 +6763,9 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, fail_req: io_put_req(req); io_req_complete(req, ret); + /* fail even hard links since we don't submit */ + if (link->head) + link->head->flags |= REQ_F_FAIL_LINK; return ret; } @@ -6791,11 +6794,8 @@ fail_req: ctx->drain_next = 1; } ret = io_req_defer_prep(req, sqe); - if (unlikely(ret)) { - /* fail even hard links since we don't submit */ - head->flags |= REQ_F_FAIL_LINK; + if (unlikely(ret)) goto fail_req; - } trace_io_uring_link(ctx, req, head); link->last->link = req; link->last = req; |