[lxc-devel] [lxc/master] fix btrfs_recursive_destroy

overlayfs on Github lxc-bot at linuxcontainers.org
Sat Apr 2 17:15:58 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 522 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160402/9977d503/attachment.bin>
-------------- next part --------------
From 8ba6dc5e536dd6dbbd382996d237c72e6e38d7ba Mon Sep 17 00:00:00 2001
From: Oleg Freedhom <overlayfs at gmail.com>
Date: Sat, 2 Apr 2016 16:18:54 +0000
Subject: [PATCH] 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 <overlayfs at gmail.com>
---
 src/lxc/bdev/lxcbtrfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lxc/bdev/lxcbtrfs.c b/src/lxc/bdev/lxcbtrfs.c
index 379a546..6b06cfd 100644
--- a/src/lxc/bdev/lxcbtrfs.c
+++ b/src/lxc/bdev/lxcbtrfs.c
@@ -616,8 +616,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)


More information about the lxc-devel mailing list