]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: handle overlay for stable 2.0 1747/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 Aug 2017 19:05:42 +0000 (21:05 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 15 Aug 2017 19:05:42 +0000 (21:05 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/bdev/bdev.c

index 221351a35f8577abfc7dd3e07016e9ddb60ee7c0..b6bd04a2f949ce7717a4e05207a2f45467e779ab 100644 (file)
@@ -368,11 +368,8 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
        if (maybe_snap && keepbdevtype && !bdevtype && !orig->ops->can_snapshot)
                snap = false;
 
-       /*
-        * If newtype is NULL and snapshot is set, then use overlayfs
-        */
-       if (!bdevtype && !keepbdevtype && snap &&
-           strcmp(orig->type, "dir") == 0)
+       /* If newtype is NULL and snapshot is set, then use overlayfs. */
+       if (!bdevtype && !keepbdevtype && snap && (!strcmp(orig->type, "dir") || !strcmp(orig->type, "overlayfs")))
                bdevtype = "overlayfs";
 
        if (am_unpriv() && !unpriv_snap_allowed(orig, bdevtype, snap, maybe_snap)) {
@@ -391,10 +388,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
                *needs_rdep = 1;
        }
 
-       if (strcmp(oldpath, lxcpath) && !bdevtype)
+       if (strcmp(oldpath, lxcpath) && !bdevtype && strcmp(orig->type, "overlayfs"))
                bdevtype = "dir";
        else if (!bdevtype)
                bdevtype = orig->type;
+
        new = bdev_get(bdevtype);
        if (!new) {
                ERROR("no such block device type: %s",