[lxc-devel] [PATCH] ovl_rsync: make sure to umount

Stéphane Graber stgraber at ubuntu.com
Mon Sep 21 19:43:15 UTC 2015


On Mon, Sep 21, 2015 at 07:33:23PM +0000, Serge Hallyn wrote:
> Otherwise the kernel will umount when it gets around to it, but
> that on lxc_destroy we may race with it and fail the rmdir of
> the overmounted (BUSY) rootfs.
> 
> This makes lxc-test-snapshot pass for me again.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

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

> ---
>  src/lxc/bdev.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index b81827e..21a64f7 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -2339,6 +2339,8 @@ static int rsync_delta_wrapper(void *data)
>  
>  static int ovl_rsync(struct ovl_rsync_data *data)
>  {
> +	int ret;
> +
>  	if (setgid(0) < 0) {
>  		ERROR("Failed to setgid to 0");
>  		return -1;
> @@ -2368,7 +2370,12 @@ static int ovl_rsync(struct ovl_rsync_data *data)
>  		ERROR("Failed mounting new container fs");
>  		return -1;
>  	}
> -	if (do_rsync(data->orig->dest, data->new->dest) < 0) {
> +	ret = do_rsync(data->orig->dest, data->new->dest);
> +
> +	overlayfs_umount(data->new);
> +	overlayfs_umount(data->orig);
> +
> +	if (ret < 0) {
>  		ERROR("rsyncing %s to %s", data->orig->dest, data->new->dest);
>  		return -1;
>  	}
> -- 
> 2.5.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/20150921/80977909/attachment.sig>


More information about the lxc-devel mailing list