]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Fixed cgclear to unmount all hierarchies mounted multiple times.
authorJan Safranek <jsafrane@redhat.com>
Wed, 6 Apr 2011 06:37:32 +0000 (08:37 +0200)
committerJan Safranek <jsafrane@redhat.com>
Mon, 18 Apr 2011 12:14:05 +0000 (14:14 +0200)
Now we have API to list all mount points, cgclear can unmount them all.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
src/config.c

index 63c5946baef18ce17a38eb03c053738d736e2f0b..5c4598c821a10f5cbd87db8b41977c066cb9bdec 100644 (file)
@@ -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);