[PATCH 1/2] io_uring/uring_cmd: copy SQE before issue_blocking punt

Yang Xiuwei <[email protected]>
Newsgroups org.kernel.vger.io-uring
Message-ID <[email protected]>
io_uring_cmd_issue_blocking() punts to io-wq without copying the SQE
off the submission queue, unlike the -EAGAIN and fallback paths. Copy
the SQE into async data before queuing the work.

Signed-off-by: Yang Xiuwei <[email protected]>
---
 io_uring/uring_cmd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 7b25dcd9d05f..fe32311b2e51 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -326,6 +326,10 @@ void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd)
 {
 	struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
 
+	if (!(req->flags & REQ_F_SQE_COPIED)) {
+		io_uring_cmd_sqe_copy(req);
+		req->flags |= REQ_F_SQE_COPIED;
+	}
 	io_req_queue_iowq(req);
 }
 
-- 
2.25.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.