[lxc-devel] [PATCH 1/1] do_rootfs_setup: fix return bugs

Stéphane Graber stgraber at ubuntu.com
Mon Oct 27 20:51:40 UTC 2014


On Mon, Oct 27, 2014 at 03:08:40AM +0000, Serge Hallyn wrote:
> Fix return value on bind mount failure.
> 
> If we've already mounted the rootfs, exit after the bind mount
> rather than re-trying the rootfs mount.  The only case where
> this happens is when root is starting a container in a user
> namespace and with a block device backing store.
> 
> In that case, pre-mount hooks will be executed in the initial
> user namespace.  That may be worth fixing.  Or it may be what
> we want.  We should think about it and fix it.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

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

> ---
>  src/lxc/conf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 9ba18fe..dc790a3 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -3984,8 +3984,9 @@ int do_rootfs_setup(struct lxc_conf *conf, const char *name, const char *lxcpath
>  		const char *path = conf->rootfs.mount;
>  		if (mount(path, path, "rootfs", MS_BIND, NULL) < 0) {
>  			ERROR("Failed to bind-mount container / onto itself");
> -			return false;
> +			return -1;
>  		}
> +		return 0;
>  	}
>  
>  	remount_all_slave();
> -- 
> 2.1.0
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20141027/3d4c8ada/attachment.sig>


More information about the lxc-devel mailing list