]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
btrfs: only chown_mapped_root() if not btrfs
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 16 Jul 2017 20:36:01 +0000 (22:36 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 31 Jul 2017 21:34:14 +0000 (23:34 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/bdev/bdev.c

index ef351b64beba327bb11d3af9e30c8c6ffe3138f0..9201ca0843a2581be7f887d713f7bed2a5ace3d2 100644 (file)
@@ -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;