]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vircgroup: Ensure /machine group is associated with its parent
authorMiguel Ángel Arruga Vivas <rosen644835@gmail.com>
Mon, 4 Nov 2019 14:55:23 +0000 (15:55 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 15 Nov 2019 14:45:25 +0000 (15:45 +0100)
Call first virCgroupNew on the parent group virCgroupNewPartition if
it is available on before the creation of the child group.  This
ensures that the creation of a first level group on the unified
architecture, as the check at virCgroupV2ParseControllersFile as the
parent file is there.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1760233
Signed-off-by: Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/vircgroup.c

index 77ffc97003a3afe56aa0f0ddadea9c3393a0dbd1..a70ffdf748008d9d3d48ee408637682f10e16d18 100644 (file)
@@ -847,9 +847,6 @@ virCgroupNewPartition(const char *path,
     if (virCgroupSetPartitionSuffix(path, &newPath) < 0)
         goto cleanup;
 
-    if (virCgroupNew(-1, newPath, NULL, controllers, group) < 0)
-        goto cleanup;
-
     if (STRNEQ(newPath, "/")) {
         char *tmp;
         parentPath = g_strdup(newPath);
@@ -860,7 +857,12 @@ virCgroupNewPartition(const char *path,
 
         if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0)
             goto cleanup;
+    }
 
+    if (virCgroupNew(-1, newPath, parent, controllers, group) < 0)
+        goto cleanup;
+
+    if (parent) {
         if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_NONE) < 0)
             goto cleanup;
     }