Commit
9cd0df397a119d6b95ad68e2c82b69b4d620694e
fs: pass flags to copy_fs()
Turn the umh boolean into a flags argument. Idle threads need their own case in copy_fs() as well and that's nicer than a second boolean. No functional changes. Link: https://patch.msgid.link/20261013-work-fs-idle_fs-v1-1-2063d1bcb5aa@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Christian Brauner <brauner@kernel.org> · 2026-10-12 22:11 UTC
1 file changed,
+8
−3
modified kernel/fork.c
| @@ -1619,7 +1619,12 @@ static int copy_exec_state(u64 clone_flags, struct task_struct *tsk) | |||
| 1619 | 1619 | return task_exec_state_copy(tsk); | |
| 1620 | 1620 | } | |
| 1621 | 1621 | ||
| 1622 | - | static int copy_fs(u64 clone_flags, struct task_struct *tsk, bool umh) | |
| 1622 | + | enum copy_fs_flags_t { | |
| 1623 | + | COPY_FS_UMH = (1 << 0), | |
| 1624 | + | }; | |
| 1625 | + | ||
| 1626 | + | static int copy_fs(u64 clone_flags, struct task_struct *tsk, | |
| 1627 | + | enum copy_fs_flags_t flags) | |
| 1623 | 1628 | { | |
| 1624 | 1629 | struct fs_struct *fs; | |
| 1625 | 1630 | ||
| @@ -1629,7 +1634,7 @@ static int copy_fs(u64 clone_flags, struct task_struct *tsk, bool umh) | |||
| 1629 | 1634 | * filesystem state, or be started from a non-initial mount | |
| 1630 | 1635 | * namespace. | |
| 1631 | 1636 | */ | |
| 1632 | - | if (umh) { | |
| 1637 | + | if (flags & COPY_FS_UMH) { | |
| 1633 | 1638 | if (clone_flags & (CLONE_NEWNS | CLONE_FS)) | |
| 1634 | 1639 | return -EINVAL; | |
| 1635 | 1640 | if (current->nsproxy->mnt_ns != &init_mnt_ns) | |
| @@ -2299,7 +2304,7 @@ __latent_entropy struct task_struct *copy_process( | |||
| 2299 | 2304 | retval = copy_files(clone_flags, p, args->no_files); | |
| 2300 | 2305 | if (retval) | |
| 2301 | 2306 | goto bad_fork_cleanup_semundo; | |
| 2302 | - | retval = copy_fs(clone_flags, p, args->umh); | |
| 2307 | + | retval = copy_fs(clone_flags, p, args->umh ? COPY_FS_UMH : 0); | |
| 2303 | 2308 | if (retval) | |
| 2304 | 2309 | goto bad_fork_cleanup_files; | |
| 2305 | 2310 | retval = copy_sighand(clone_flags, p); | |