Compare
36ebddca56b9d8993d6dc984fdecc748ee1f5e06..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
3 files changed,
+12
−5
modified fs/namei.c
| @@ -4750,8 +4750,7 @@ static struct dentry *lookup_fast_for_open(struct nameidata *nd, int open_flag) | |||
| 4750 | 4750 | return dentry; | |
| 4751 | 4751 | ||
| 4752 | 4752 | if (open_flag & O_CREAT) { | |
| 4753 | - | /* Discard negative dentries. Need inode_lock to do the create */ | |
| 4754 | - | if (!dentry->d_inode) { | |
| 4753 | + | if (d_is_negative(dentry)) { | |
| 4755 | 4754 | if (!(nd->flags & LOOKUP_RCU)) | |
| 4756 | 4755 | dput(dentry); | |
| 4757 | 4756 | dentry = NULL; | |
modified fs/overlayfs/params.c
| @@ -216,6 +216,9 @@ static ssize_t ovl_parse_param_split_lowerdirs(char *str) | |||
| 216 | 216 | if (*s == '\\') { | |
| 217 | 217 | /* keep esc chars in split lowerdir */ | |
| 218 | 218 | *d++ = *s++; | |
| 219 | + | /* A trailing backslash escapes nothing. */ | |
| 220 | + | if (!*s) | |
| 221 | + | return -EINVAL; | |
| 219 | 222 | } else if (*s == ':') { | |
| 220 | 223 | bool next_colon = (*(s + 1) == ':'); | |
| 221 | 224 | ||
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); | |