From: Christian Brauner Date: Sun, 16 Jul 2017 20:36:01 +0000 (+0200) Subject: btrfs: only chown_mapped_root() if not btrfs X-Git-Tag: lxc-2.1.0~32^2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a9e0f3546f0aaa1e3ee8837c32fd1d8d17bec5c;p=thirdparty%2Flxc.git btrfs: only chown_mapped_root() if not btrfs Signed-off-by: Christian Brauner --- diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c index ef351b64b..9201ca084 100644 --- a/src/lxc/bdev/bdev.c +++ b/src/lxc/bdev/bdev.c @@ -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;