archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <>
To: Jens Axboe <>,
Subject: [PATCH] io_uring: don't submit half-prepared drain request
Date: Tue, 31 Aug 2021 10:53:47 +0100	[thread overview]
Message-ID: <> (raw)

io_drain_req() goes before checks for REQ_F_FAIL, which protect us from
submitting under-prepared request (e.g. failed in io_init_req(). Fail
such drained requests as well.

Fixes: a8295b982c46d ("io_uring: fix failed linkchain code logic")
Signed-off-by: Pavel Begunkov <>
 fs/io_uring.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index a531c7324ea8..8902ff5add47 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6221,6 +6221,13 @@ static bool io_drain_req(struct io_kiocb *req)
 	int ret;
 	u32 seq;
+	if (req->flags & REQ_F_FAIL) {
+		/* fail all, we don't submit */
+		req->flags &= ~REQ_F_HARDLINK;
+		io_req_complete_failed(req, req->result);
+		return true;
+	}
 	 * If we need to drain a request in the middle of a link, drain the
 	 * head request and the next request/link after the current link.

                 reply	other threads:[~2021-08-31  9:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).