diff options
| author | Jens Axboe <axboe@kernel.dk> | 2026-01-16 15:28:58 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-02-06 07:29:14 -0700 |
| commit | 9fd99788f3e5a129908c242bb29946077ca46611 (patch) | |
| tree | e70e04809c1cc4d7466da5d2ede77b1861e054c0 /kernel | |
| parent | e7f67c2be7877a3d44aa79b8d22eae8cb6e2c6d6 (diff) | |
io_uring: add task fork hook
Called when copy_process() is called to copy state to a new child.
Right now this is just a stub, but will be used shortly to properly
handle fork'ing of task based io_uring restrictions.
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index b1f3915d5f8e..1605ee9bf835 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -97,6 +97,7 @@ #include <linux/kasan.h> #include <linux/scs.h> #include <linux/io_uring.h> +#include <linux/io_uring_types.h> #include <linux/bpf.h> #include <linux/stackprotector.h> #include <linux/user_events.h> @@ -2129,6 +2130,10 @@ __latent_entropy struct task_struct *copy_process( #ifdef CONFIG_IO_URING p->io_uring = NULL; + retval = io_uring_fork(p); + if (unlikely(retval)) + goto bad_fork_cleanup_delayacct; + retval = -EAGAIN; #endif p->default_timer_slack_ns = current->timer_slack_ns; @@ -2525,6 +2530,7 @@ bad_fork_cleanup_policy: mpol_put(p->mempolicy); #endif bad_fork_cleanup_delayacct: + io_uring_free(p); delayacct_tsk_free(p); bad_fork_cleanup_count: dec_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1); |
