DORMANTno replies

[PATCH] io_uring: don't submit half-prepared drain request

From: Pavel Begunkov <asml.silence@gmail.com>
Date: 2021-08-31 09:54:29
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

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 <asml.silence@gmail.com>
---
 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.
-- 
2.33.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help