When cgclear is invoked against a cgroup v2 controller, do not attempt to unmount the v2 controller.
Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com> --- src/config.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/config.c b/src/config.c index 3ffa26371405..11d1da4897d0 100644 --- a/src/config.c +++ b/src/config.c @@ -1331,6 +1331,7 @@ static int cgroup_config_unload_controller(const struct cgroup_mount_point *moun struct cgroup_controller *cgc = NULL; char path[FILENAME_MAX]; void *handle; + enum cg_version_t version; cgroup = cgroup_new_cgroup("."); if (cgroup == NULL) @@ -1346,6 +1347,14 @@ static int cgroup_config_unload_controller(const struct cgroup_mount_point *moun if (ret != 0) goto out_error; + ret = cgroup_get_controller_version(mount_info->name, &version); + if (ret != 0) + goto out_error; + + if (version == CGROUP_V2) + /* do not unmount the controller */ + goto out_error; + /* unmount everything */ ret = cgroup_get_subsys_mount_point_begin(mount_info->name, &handle, path); -- 2.26.2 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel