[lxc-devel] [PATCH 1/2] clean up syncs

Stéphane Graber stgraber at ubuntu.com
Tue Jan 15 16:52:35 UTC 2013


On 01/14/2013 06:32 PM, Serge Hallyn wrote:
> Always unblock parent when child setup fails, rather than just
> exiting.
> 
> Also remove a duplicate call to setup_cgroup().  We'll want it
> close to there for userns, but not right there - that's too late,
> and could happen after container init has done something bad
> without cgroup restrictions.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/start.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/src/lxc/start.c b/src/lxc/start.c
> index e78f685..2eb17d8 100644
> --- a/src/lxc/start.c
> +++ b/src/lxc/start.c
> @@ -585,7 +585,7 @@ static int do_start(void *data)
>  	if (handler->conf->need_utmp_watch) {
>  		if (prctl(PR_CAPBSET_DROP, CAP_SYS_BOOT, 0, 0, 0)) {
>  			SYSERROR("failed to remove CAP_SYS_BOOT capability");
> -			return -1;
> +			goto out_warn_father;
>  		}
>  		DEBUG("Dropped cap_sys_boot\n");
>  	}
> @@ -620,15 +620,14 @@ static int do_start(void *data)
>  
>  	if (putenv("container=lxc")) {
>  		SYSERROR("failed to set environment variable");
> -		return -1;
> +		goto out_warn_father;
>  	}
>  
>  	close(handler->sigfd);
>  
>  	/* after this call, we are in error because this
>  	 * ops should not return as it execs */
> -	if (handler->ops->start(handler, handler->data))
> -		return -1;
> +	handler->ops->start(handler, handler->data);
>  
>  out_warn_father:
>  	lxc_sync_wake_parent(handler, LXC_SYNC_POST_CONFIGURE);
> @@ -751,11 +750,6 @@ int lxc_spawn(struct lxc_handler *handler)
>  	if (detect_shared_rootfs())
>  		umount2(handler->conf->rootfs.mount, MNT_DETACH);
>  
> -	if (setup_cgroup(name, &handler->conf->cgroup)) {
> -		ERROR("failed to setup the cgroups for '%s'", name);
> -		goto out_delete_net;
> -	}
> -
>  	if (handler->ops->post_start(handler, handler->data))
>  		goto out_abort;
>  
> 


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130115/f1469689/attachment.pgp>


More information about the lxc-devel mailing list