Skip to content

Commit

Permalink
ovl_rsync: make sure to umount
Browse files Browse the repository at this point in the history
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@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
hallyn authored and stgraber committed Sep 21, 2015
1 parent e228426 commit 3563f36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lxc/bdev.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3563f36

Please sign in to comment.