From a0bb8b71b79a215d0a947a7bf30a1ebc1134fed1 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Tue, 5 Oct 2010 13:21:10 +0530 Subject: [PATCH] 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 --- src/config.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; } /* -- 2.47.2