From: Jan Safranek Date: Tue, 5 Oct 2010 07:51:10 +0000 (+0530) Subject: If cgconfigparser fails, it tries to delete created groups. But if they are X-Git-Tag: v0.37.1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0bb8b71b79a215d0a947a7bf30a1ebc1134fed1;p=thirdparty%2Flibcgroup.git If cgconfigparser fails, it tries to delete created groups. But if they are 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 Reviewed-By: Ivana Hutarova Varekova Tested-By: Ivana Hutarova Varekova Signed-off-by: Balbir Singh --- diff --git a/src/config.c b/src/config.c index abf90e71..c38b69ec 100644 --- a/src/config.c +++ b/src/config.c @@ -442,16 +442,20 @@ static int cgroup_config_create_groups(void) */ 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; } /*