[lxc-devel] [lxd/master] lxd/storage/btrfs: Workaround permission issue

stgraber on Github lxc-bot at linuxcontainers.org
Sat Apr 4 21:39:46 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200404/37f76df4/attachment.bin>
-------------- next part --------------
From 864cf2e28aee0d54890bd2ab3ca0c9f2d6a794fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 4 Apr 2020 17:39:18 -0400
Subject: [PATCH] lxd/storage/btrfs: Workaround permission issue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage/drivers/driver_btrfs_utils.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/storage/drivers/driver_btrfs_utils.go b/lxd/storage/drivers/driver_btrfs_utils.go
index e21ba39c4f..e097cfbd60 100644
--- a/lxd/storage/drivers/driver_btrfs_utils.go
+++ b/lxd/storage/drivers/driver_btrfs_utils.go
@@ -160,6 +160,10 @@ func (d *btrfs) deleteSubvolume(path string, recursion bool) error {
 		// Attempt to make the subvolume writable.
 		shared.RunCommand("btrfs", "property", "set", path, "ro", "false")
 
+		// Temporarily change ownership & mode to help with nesting.
+		os.Chmod(path, 0700)
+		os.Chown(path, 0, 0)
+
 		// Delete the subvolume itself.
 		_, err = shared.RunCommand("btrfs", "subvolume", "delete", path)
 


More information about the lxc-devel mailing list