On Wed, Jan 29, 2014 at 04:17:09PM +0000, Serge Hallyn wrote:
> userns_exec_1() clones a new task to manipulate.  We don't
> need to fork before calling that.
> 
> Signed-off-by: Serge Hallyn <[email protected]>

Acked-by: Stéphane Graber <[email protected]>

> ---
>  src/lxc/cgmanager.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c
> index 29c0e99..797e2ae 100644
> --- a/src/lxc/cgmanager.c
> +++ b/src/lxc/cgmanager.c
> @@ -247,7 +247,6 @@ static int chown_cgroup_wrapper(void *data)
>  static bool chown_cgroup(const char *controller, const char *cgroup_path,
>                       struct lxc_conf *conf)
>  {
> -     pid_t pid;
>       struct chown_data data;
>       data.controller = controller;
>       data.cgroup_path = cgroup_path;
> @@ -258,20 +257,11 @@ static bool chown_cgroup(const char *controller, const 
> char *cgroup_path,
>               return true;
>       }
>  
> -     if ((pid = fork()) < 0) {
> -             SYSERROR("fork");
> +     if (userns_exec_1(conf, chown_cgroup_wrapper, &data) < 0) {
> +             ERROR("Error requesting cgroup chown in new namespace");
>               return false;
>       }
> -     if (pid > 0) {
> -             if (wait_for_pid(pid)) {
> -                     ERROR("Error chowning cgroup");
> -                     return false;
> -             }
> -             return true;
> -     }
> -     if (userns_exec_1(conf, chown_cgroup_wrapper, &data) < 0)
> -             exit(1);
> -     exit(0);
> +     return true;
>  }
>  
>  struct cgm_data {
> -- 
> 1.8.5.3
> 
> _______________________________________________
> lxc-devel mailing list
> [email protected]
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: Digital signature

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to