[lxc-devel] [lxd/master] lxd/storage/zfs: Always discard mountpoint on recv

stgraber on Github lxc-bot at linuxcontainers.org
Sat Aug 22 23:05:46 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200822/8986cd35/attachment.bin>
-------------- next part --------------
From b2e39a9287495a2fb2e8961691b61e3badcf3fc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 22 Aug 2020 19:04:19 -0400
Subject: [PATCH] lxd/storage/zfs: Always discard mountpoint on recv
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7724

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage/drivers/driver_zfs_utils.go   | 4 ++--
 lxd/storage/drivers/driver_zfs_volumes.go | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lxd/storage/drivers/driver_zfs_utils.go b/lxd/storage/drivers/driver_zfs_utils.go
index 62619abf6d..bf67e58053 100644
--- a/lxd/storage/drivers/driver_zfs_utils.go
+++ b/lxd/storage/drivers/driver_zfs_utils.go
@@ -266,8 +266,8 @@ func (d *zfs) sendDataset(dataset string, parent string, volSrcArgs *migration.V
 }
 
 func (d *zfs) receiveDataset(dataset string, conn io.ReadWriteCloser, writeWrapper func(io.WriteCloser) io.WriteCloser) error {
-	// Assemble zfs send command.
-	cmd := exec.Command("zfs", "receive", "-F", "-u", dataset)
+	// Assemble zfs receive command.
+	cmd := exec.Command("zfs", "receive", "-x", "mountpoint", "-F", "-u", dataset)
 
 	// Prepare stdin/stderr.
 	stdin, err := cmd.StdinPipe()
diff --git a/lxd/storage/drivers/driver_zfs_volumes.go b/lxd/storage/drivers/driver_zfs_volumes.go
index 3edbc96456..c936189a64 100644
--- a/lxd/storage/drivers/driver_zfs_volumes.go
+++ b/lxd/storage/drivers/driver_zfs_volumes.go
@@ -307,7 +307,7 @@ func (d *zfs) CreateVolumeFromBackup(vol Volume, srcBackup backup.Info, srcData
 
 			if hdr.Name == srcFile {
 				// Extract the backup.
-				err = shared.RunCommandWithFds(tr, nil, "zfs", "receive", "-F", target)
+				err = shared.RunCommandWithFds(tr, nil, "zfs", "receive", "-x", "mountpoint", "-F", target)
 
 				if err != nil {
 					return err
@@ -487,7 +487,7 @@ func (d *zfs) CreateVolumeFromCopy(vol Volume, srcVol Volume, copySnapshots bool
 
 		// Send/receive the snapshot.
 		var sender *exec.Cmd
-		receiver := exec.Command("zfs", "receive", d.dataset(vol, false))
+		receiver := exec.Command("zfs", "receive", "-x", "mountpoint", d.dataset(vol, false))
 
 		// Handle transferring snapshots.
 		if len(snapshots) > 0 {


More information about the lxc-devel mailing list