Revert "btrfs: simplify"

This reverts commit 1aa0201f. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 97788c72
......@@ -441,6 +441,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
goto err;
}
if (mkdir_p(new->dest, 0755) < 0) {
ERROR("Failed to create directory \"%s\"", new->dest);
goto err;
}
arg.src = orig->dest;
arg.dest = new->dest;
if (am_unpriv())
......
......@@ -413,19 +413,8 @@ int btrfs_clonepaths(struct bdev *orig, struct bdev *new, const char *oldname,
if (snap) {
struct rsync_data_char sdata;
if (!am_unpriv()) {
ret = btrfs_snapshot(orig->dest, new->dest);
if (ret < 0) {
SYSERROR("Failed to create btrfs snapshot "
"\"%s\" from \"%s\"",
new->dest, orig->dest);
return -1;
}
TRACE("Created btrfs snapshot \"%s\" from \"%s\"",
new->dest, orig->dest);
return 0;
}
if (!am_unpriv())
return btrfs_snapshot(orig->dest, new->dest);
sdata.dest = new->dest;
sdata.src = orig->dest;
return userns_exec_1(conf, btrfs_snapshot_wrapper, &sdata,
......@@ -441,8 +430,6 @@ int btrfs_clonepaths(struct bdev *orig, struct bdev *new, const char *oldname,
ret = btrfs_subvolume_create(new->dest);
if (ret < 0)
SYSERROR("Failed to create btrfs subvolume \"%s\"", new->dest);
else
TRACE("Created btrfs subvolume \"%s\"", new->dest);
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment