[lxc-devel] [lxd/master] Pass the -r flag when copying a snapshot backed by a btrfs subvolume

freeekanayaka on Github lxc-bot at linuxcontainers.org
Tue Jun 4 16:05:47 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 603 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190604/e98366f1/attachment.bin>
-------------- next part --------------
From 06f83fdffe6ac70aa1ff842b51d939e58ab1461f Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Tue, 4 Jun 2019 18:03:13 +0200
Subject: [PATCH] This fixes #5804.

The problem was that btrfs send wants a snapshot to be readonly (to prevent
interim modification), but we were not passing the "-r" flag when creating btrfs
subvolume for copying the snapshots of a source container.

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/storage_btrfs.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 2ce3bca3ad..be7e96245f 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -1060,7 +1060,7 @@ func (s *storageBtrfs) copySnapshot(target container, source container) error {
 		}
 	}
 
-	err = s.btrfsPoolVolumesSnapshot(sourceContainerSubvolumeName, targetContainerSubvolumeName, false, true)
+	err = s.btrfsPoolVolumesSnapshot(sourceContainerSubvolumeName, targetContainerSubvolumeName, true, true)
 	if err != nil {
 		return err
 	}


More information about the lxc-devel mailing list