Skip to content

Commit

Permalink
lxczfs: small fixes
Browse files Browse the repository at this point in the history
- We expect destroy to fail in zfs_clone() so try to silence it so users are
  not irritated when they create zfs snapshots.
- Add -r recursive to zfs_destroy(). This code is only hit when a) the
  container has no snapshots or b) the user calls destroy with snapshots. So
  this should be safe. Without -r snapshots will remain.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Nov 17, 2016
1 parent 000d60e commit 6a04409
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lxc/bdev.c
Expand Up @@ -660,6 +660,9 @@ static int zfs_clone(const char *opath, const char *npath, const char *oname,
if ((pid = fork()) < 0)
return -1;
if (!pid) {
int dev0 = open("/dev/null", O_WRONLY);
if (dev0 >= 0)
dup2(dev0, STDERR_FILENO);
execlp("zfs", "zfs", "destroy", path1, NULL);
exit(1);
}
Expand Down Expand Up @@ -740,7 +743,7 @@ static int zfs_destroy(struct bdev *orig)
return -1;
*p = '\0';

execlp("zfs", "zfs", "destroy", output, NULL);
execlp("zfs", "zfs", "destroy", "-r", output, NULL);
exit(1);
}

Expand Down

0 comments on commit 6a04409

Please sign in to comment.