On 04/06/2011 10:37 AM, Jan Safranek wrote:
> Now we have API to list all mount points, cgclear can unmount them all.
>
> Signed-off-by: Jan Safranek<jsafr...@redhat.com>
Acked-by: Ivana Hutarova Varekova<varek...@redhat.com>

> ---
>
>   src/config.c |   22 ++++++++++++++++------
>   1 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/src/config.c b/src/config.c
> index 63c5946..5c4598c 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);
>
>
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> Libcg-devel mailing list
> Libcg-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libcg-devel


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to