Skip to content

Commit

Permalink
btrfs: only chown_mapped_root() if not btrfs
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 31, 2017
1 parent 3324c25 commit 7a9e0f3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/lxc/bdev/bdev.c
Expand Up @@ -412,12 +412,17 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
goto err;
}

if (!strcmp(new->type, "overlay") || !strcmp(new->type, "overlayfs"))
src_no_prefix = ovl_get_lower(new->src);
else
src_no_prefix = lxc_storage_get_path(new->src, new->type);
if (am_unpriv() && chown_mapped_root(src_no_prefix, c0->lxc_conf) < 0)
WARN("Failed to update ownership of %s", new->dest);
/* If the storage driver is "btrfs" then the we will create snapshot. */
if (strcmp(bdevtype, "btrfs")) {
if (!strcmp(new->type, "overlay") ||
!strcmp(new->type, "overlayfs"))
src_no_prefix = ovl_get_lower(new->src);
else
src_no_prefix = lxc_storage_get_path(new->src, new->type);

if (am_unpriv() && chown_mapped_root(src_no_prefix, c0->lxc_conf) < 0)
WARN("Failed to chown \"%s\"", src_no_prefix);
}

if (snap)
return new;
Expand Down

0 comments on commit 7a9e0f3

Please sign in to comment.