diff mbox series

[RFC,8/9] io_uring: Let ->issue know if it was called from spawn thread

Message ID 20241209234316.4132786-9-krisman@suse.de (mailing list archive)
State New
Headers show
Series Launching processes with io_uring | expand

Commit Message

Gabriel Krisman Bertazi Dec. 9, 2024, 11:43 p.m. UTC
IORING_OP_EXEC can only be called from the spawn task context.  Pass
that information via the issue_flags to let it be verified by the
IORING_OP_EXEC handler.

Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 include/linux/io_uring_types.h | 3 +++
 io_uring/spawn.c               | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index c141ffec81fe..8717259ba715 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -38,6 +38,9 @@  enum io_uring_cmd_flags {
 	IO_URING_F_CANCEL		= (1 << 11),
 	IO_URING_F_COMPAT		= (1 << 12),
 	IO_URING_F_TASK_DEAD		= (1 << 13),
+
+	/* Set when issuing from spawn thread */
+	IO_URING_F_SPAWN		= (1 << 14),
 };
 
 struct io_wq_work_node {
diff --git a/io_uring/spawn.c b/io_uring/spawn.c
index 1cd069bb6f59..59d6ccf96f45 100644
--- a/io_uring/spawn.c
+++ b/io_uring/spawn.c
@@ -52,7 +52,7 @@  static int io_uring_spawn_task(void *data)
 		req->flags &= ~(REQ_F_HARDLINK | REQ_F_LINK);
 
 		if (!(req->flags & REQ_F_FAIL)) {
-			err = io_issue_sqe(req, IO_URING_F_COMPLETE_DEFER);
+			err = io_issue_sqe(req, IO_URING_F_COMPLETE_DEFER|IO_URING_F_SPAWN);
 			/*
 			 * We can't requeue a request from the spawn
 			 * context.  Fail the whole chain.