From: Oleg Freedhom Date: Sat, 2 Apr 2016 16:18:54 +0000 (+0000) Subject: fix btrfs_recursive_destroy X-Git-Tag: lxc-1.0.9~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=553aa63d1372100ec299b16fc8cacee1e3c054b8;p=thirdparty%2Flxc.git fix btrfs_recursive_destroy A change in kernel 4.2 caused btrfs_recursive_destroy to fail to delete unprivileged containers. This patch restores the pre-kernel-4.2 behaviour. Ref: Issue 935. Signed-off-by: Oleg Freedhom --- diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c index 3c338c604..165989947 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -1767,8 +1767,13 @@ static int btrfs_recursive_destroy(const char *path) ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args); if (ret < 0) { close(fd); - ERROR("Error: can't perform the search under %s\n", path); free_btrfs_tree(tree); + if (errno == EPERM || errno == EACCES) { + WARN("Warn: can't perform the search under %s. Will simply try removing", path); + goto ignore_search; + } + + ERROR("Error: can't perform the search under %s\n", path); return -1; } if (sk->nr_items == 0)