Tested and reviewed.

Acked-By: Ivana Hutarova Varekova <[email protected]>

On 10/04/2010 09:57 AM, Jan Safranek wrote:
> 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<[email protected]>
> ---
>
>   src/config.c |   14 +++++++++-----
>   1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/src/config.c b/src/config.c
> index abf90e7..c38b69e 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;
>   }
>
>   /*
>
>
> ------------------------------------------------------------------------------
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> _______________________________________________
> Libcg-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libcg-devel
>    


------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to