cgroups: ensure leaf cgroup is correctly pruned on creation failure

parent cb423bd3
...@@ -1159,8 +1159,8 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf, ...@@ -1159,8 +1159,8 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
return true; return true;
} }
static void cgroup_tree_leaf_remove(struct hierarchy *h, const char *path_prune, static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune,
bool payload) bool payload)
{ {
int ret; int ret;
...@@ -1357,9 +1357,9 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx ...@@ -1357,9 +1357,9 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
continue; continue;
DEBUG("Failed to create cgroup \"%s\"", maybe_empty(ops->hierarchies[i]->monitor_full_path)); DEBUG("Failed to create cgroup \"%s\"", maybe_empty(ops->hierarchies[i]->monitor_full_path));
for (int j = 0; j < i; j++) for (int j = 0; j <= i; j++)
cgroup_tree_leaf_remove(ops->hierarchies[j], cgroup_tree_prune_leaf(ops->hierarchies[j],
monitor_cgroup, false); monitor_cgroup, false);
idx++; idx++;
break; break;
...@@ -1456,10 +1456,10 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx ...@@ -1456,10 +1456,10 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
continue; continue;
DEBUG("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path ?: "(null)"); DEBUG("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path ?: "(null)");
for (int j = 0; j < i; j++) for (int j = 0; j <= i; j++)
cgroup_tree_leaf_remove(ops->hierarchies[j], cgroup_tree_prune_leaf(ops->hierarchies[j],
limiting_cgroup ?: container_cgroup, limiting_cgroup ?: container_cgroup,
true); true);
idx++; idx++;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment