summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2022-07-14 18:38:43 -1000
committerTejun Heo <tj@kernel.org>2022-07-22 19:12:52 -1000
commit30312730bd029f567045c38098d7e5a62e9aa658 (patch)
treef5806fd3378f76fffb7ffb96bf0dff65a7ab298b /kernel/cgroup/cgroup.c
parent671c11f0619e5ccb380bcf0f062f69ba95fc974a (diff)
downloadlinux-30312730bd029f567045c38098d7e5a62e9aa658.tar.bz2
cgroup: Add "no" prefixed mount options
We allow modifying these mount options via remount. Let's add "no" prefixed variants so that they can be turned off too. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Christian Brauner <brauner@kernel.org> Cc: Michal Koutný <mkoutny@suse.com>
Diffstat (limited to 'kernel/cgroup/cgroup.c')
-rw-r--r--kernel/cgroup/cgroup.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index f8e00affe007..9ce24d5cf2d5 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -279,8 +279,6 @@ bool cgroup_ssid_enabled(int ssid)
*
* - When mounting an existing superblock, mount options should match.
*
- * - Remount is disallowed.
- *
* - rename(2) is disallowed.
*
* - "tasks" is removed. Everything should be at process granularity. Use
@@ -1859,16 +1857,19 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node,
}
enum cgroup2_param {
- Opt_nsdelegate,
- Opt_memory_localevents,
- Opt_memory_recursiveprot,
+ Opt_nsdelegate, Opt_nonsdelegate,
+ Opt_memory_localevents, Opt_memory_nolocalevents,
+ Opt_memory_recursiveprot, Opt_memory_norecursiveprot,
nr__cgroup2_params
};
static const struct fs_parameter_spec cgroup2_fs_parameters[] = {
fsparam_flag("nsdelegate", Opt_nsdelegate),
+ fsparam_flag("nonsdelegate", Opt_nonsdelegate),
fsparam_flag("memory_localevents", Opt_memory_localevents),
+ fsparam_flag("memory_nolocalevents", Opt_memory_nolocalevents),
fsparam_flag("memory_recursiveprot", Opt_memory_recursiveprot),
+ fsparam_flag("memory_norecursiveprot", Opt_memory_norecursiveprot),
{}
};
@@ -1886,12 +1887,21 @@ static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param
case Opt_nsdelegate:
ctx->flags |= CGRP_ROOT_NS_DELEGATE;
return 0;
+ case Opt_nonsdelegate:
+ ctx->flags &= ~CGRP_ROOT_NS_DELEGATE;
+ return 0;
case Opt_memory_localevents:
ctx->flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS;
return 0;
+ case Opt_memory_nolocalevents:
+ ctx->flags &= ~CGRP_ROOT_MEMORY_LOCAL_EVENTS;
+ return 0;
case Opt_memory_recursiveprot:
ctx->flags |= CGRP_ROOT_MEMORY_RECURSIVE_PROT;
return 0;
+ case Opt_memory_norecursiveprot:
+ ctx->flags &= ~CGRP_ROOT_MEMORY_RECURSIVE_PROT;
+ return 0;
}
return -EINVAL;
}