Revert "btrfs: enable unprivileged snapshots"

This reverts commit 2d66f571. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 05ed3a82
...@@ -432,28 +432,17 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, ...@@ -432,28 +432,17 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
if (bdevtype && strcmp(orig->type, "btrfs") == 0 && if (bdevtype && strcmp(orig->type, "btrfs") == 0 &&
strcmp(new->type, "btrfs") == 0 && strcmp(new->type, "btrfs") == 0 &&
btrfs_same_fs(orig->dest, new->dest) == 0) { btrfs_same_fs(orig->dest, new->dest) == 0) {
struct rsync_data_char arg;
if (btrfs_destroy(new) < 0) { if (btrfs_destroy(new) < 0) {
ERROR("Error destroying %s subvolume", new->dest); ERROR("Error destroying %s subvolume", new->dest);
goto err; goto err;
} }
if (mkdir_p(new->dest, 0755) < 0) { if (mkdir_p(new->dest, 0755) < 0) {
ERROR("Error creating %s directory", new->dest); ERROR("Error creating %s directory", new->dest);
goto err; goto err;
} }
if (btrfs_snapshot(orig->dest, new->dest) < 0) {
arg.src = orig->dest; ERROR("Error restoring %s to %s", orig->dest,
arg.dest = new->dest; new->dest);
if (am_unpriv())
ret = userns_exec_1(c0->lxc_conf, btrfs_snapshot_wrapper,
&arg, "btrfs_snapshot_wrapper");
else
ret = btrfs_snapshot(orig->dest, new->dest);
if (ret < 0) {
SYSERROR("Failed to create btrfs snapshot \"%s\" of \"%s\"",
new->dest, orig->dest);
goto err; goto err;
} }
bdev_put(orig); bdev_put(orig);
......
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