From 38bf91fae783835887d7761fb555ce904de5b1ab Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Wed, 6 Apr 2011 08:37:32 +0200 Subject: [PATCH] Fixed cgclear to unmount all hierarchies mounted multiple times. Now we have API to list all mount points, cgclear can unmount them all. Signed-off-by: Jan Safranek Acked-by: Ivana Hutarova Varekova --- src/config.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/config.c b/src/config.c index 63c5946b..5c4598c8 100644 --- a/src/config.c +++ b/src/config.c @@ -741,6 +741,8 @@ static int cgroup_config_unload_controller(const struct cgroup_mount_point *moun int ret, error; struct cgroup *cgroup = NULL; struct cgroup_controller *cgc = NULL; + char path[FILENAME_MAX]; + void *handle; cgroup = cgroup_new_cgroup("."); if (cgroup == NULL) @@ -756,13 +758,21 @@ static int cgroup_config_unload_controller(const struct cgroup_mount_point *moun if (ret != 0) goto out_error; - error = umount(mount_info->path); - if (error) { - last_errno = errno; - ret = ECGOTHER; - goto out_error; + /* unmount everything */ + ret = cgroup_get_subsys_mount_point_begin(mount_info->name, &handle, + path); + while (ret == 0) { + error = umount(path); + if (error) { + last_errno = errno; + ret = ECGOTHER; + goto out_error; + } + ret = cgroup_get_subsys_mount_point_next(&handle, path); } - + cgroup_get_subsys_mount_point_end(&handle); + if (ret == ECGEOF) + ret = 0; out_error: if (cgroup) cgroup_free(&cgroup); -- 2.47.2