]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix btrfs_recursive_destroy
authorOleg Freedhom <overlayfs@gmail.com>
Sat, 2 Apr 2016 16:18:54 +0000 (16:18 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 17 Nov 2016 23:12:35 +0000 (18:12 -0500)
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 <overlayfs@gmail.com>
src/lxc/bdev.c

index 3c338c6048939d650ea57e918b087041f973eb87..1659899472c8acea26440f6e33d300986599a247 100644 (file)
@@ -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)