[lxc-devel] [PATCH] Prevent from error on umount /proc if userns are used.

Serge Hallyn serge.hallyn at ubuntu.com
Wed Jul 29 18:24:03 UTC 2015


Quoting Przemek Rudy (prudy1 at o2.pl):
> Signed-off-by: Przemek Rudy <prudy1 at o2.pl>

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

> ---
> This patch solves the problem when umounting /proc causes error
> preventing from container startup. This happens when initram
> together with userns are used. In such case umount fails, which 
> is expected and should not result in permanent error.
>  src/lxc/conf.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 9870455..e6e2a4a 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -1368,10 +1368,8 @@ int prepare_ramfs_root(char *root)
>  			break;
>  	}
>  
> -	if (umount2("./proc", MNT_DETACH)) {
> -		SYSERROR("Unable to umount /proc");
> -		return -1;
> -	}
> +	/* This also can be skipped if a container uses unserns */
> +	umount2("./proc", MNT_DETACH);
>  
>  	/* It is weird, but chdir("..") moves us in a new root */
>  	if (chdir("..") == -1) {
> -- 
> 2.4.3
> 
> _______________________________________________
> 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