[lxc-devel] [PATCH 2/3] Exit on errors in restore()'s worker

Serge Hallyn serge.hallyn at ubuntu.com
Thu Sep 4 22:06:16 UTC 2014


Quoting Tycho Andersen (tycho.andersen at canonical.com):
> If we just return here, we end up with two processes executing the caller's
> code, which is not good.
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

Thanks.

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/lxccontainer.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index ee8f491..6d45c8e 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -3857,7 +3857,7 @@ static bool lxcapi_restore(struct lxc_container *c, char *directory, bool verbos
>  		struct criu_opts os;
>  
>  		if (unshare(CLONE_NEWNS))
> -			return false;
> +			exit(1);
>  
>  		/* CRIU needs the lxc root bind mounted so that it is the root of some
>  		 * mount. */
> @@ -3865,15 +3865,15 @@ static bool lxcapi_restore(struct lxc_container *c, char *directory, bool verbos
>  
>  		if (rootfs_is_blockdev(c->lxc_conf)) {
>  			if (do_rootfs_setup(c->lxc_conf, c->name, c->config_path) < 0)
> -				return false;
> +				exit(1);
>  		}
>  		else {
>  			if (mkdir(rootfs->mount, 0755) < 0 && errno != EEXIST)
> -				return false;
> +				exit(1);
>  
>  			if (mount(rootfs->path, rootfs->mount, NULL, MS_BIND, NULL) < 0) {
>  				rmdir(rootfs->mount);
> -				return false;
> +				exit(1);
>  			}
>  		}
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list