in the config file in wrong order, it tries to remove a parent group before
its children are destroyed, resulting into error.
The roll back should use recursive delete. And in addition, it should
delete as much as possible, not to stop on first error.
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-By: Ivana Hutarova Varekova <varekova@redhat.com>
Tested-By: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
*/
static int cgroup_config_destroy_groups(void)
{
- int error = 0;
+ int error = 0, ret = 0;
int i;
for (i = 0; i < cgroup_table_index; i++) {
struct cgroup *cgroup = &config_cgroup_table[i];
- error = cgroup_delete_cgroup(cgroup, 0);
- if (error)
- return error;
+ error = cgroup_delete_cgroup_ext(cgroup,
+ CGFLAG_DELETE_RECURSIVE
+ | CGFLAG_DELETE_IGNORE_MIGRATION);
+ if (error) {
+ /* store the error, but continue deleting the rest */
+ ret = error;
+ }
}
- return error;
+ return ret;
}
/*