Skip to content

Commit

Permalink
Revert "btrfs: enable unprivileged snapshots"
Browse files Browse the repository at this point in the history
This reverts commit 2d66f57.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Aug 15, 2017
1 parent 05ed3a8 commit 8cc9f7a
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/lxc/bdev/bdev.c
Expand Up @@ -432,28 +432,17 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
if (bdevtype && strcmp(orig->type, "btrfs") == 0 &&
strcmp(new->type, "btrfs") == 0 &&
btrfs_same_fs(orig->dest, new->dest) == 0) {
struct rsync_data_char arg;

if (btrfs_destroy(new) < 0) {
ERROR("Error destroying %s subvolume", new->dest);
goto err;
}

if (mkdir_p(new->dest, 0755) < 0) {
ERROR("Error creating %s directory", new->dest);
goto err;
}

arg.src = orig->dest;
arg.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);
if (btrfs_snapshot(orig->dest, new->dest) < 0) {
ERROR("Error restoring %s to %s", orig->dest,
new->dest);
goto err;
}
bdev_put(orig);
Expand Down

0 comments on commit 8cc9f7a

Please sign in to comment.