[lxc-devel] [lxd/master] lxd/storage/zfs: Use TryUnmount

stgraber on Github lxc-bot at linuxcontainers.org
Wed May 6 18:53:44 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 508 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200506/0478516f/attachment.bin>
-------------- next part --------------
From 7de16487fb69bd3c4895a76627e2302829433151 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 6 May 2020 14:50:41 -0400
Subject: [PATCH] lxd/storage/zfs: Use TryUnmount
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

"zfs unmount" annoyingly wraps errors so just use our own TryUnmount
instead so we can deal with things taking a bit long to unmount.

Closes #7296

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

diff --git a/lxd/storage/drivers/driver_zfs_volumes.go b/lxd/storage/drivers/driver_zfs_volumes.go
index b9f88d13d8..4bc5c6655b 100644
--- a/lxd/storage/drivers/driver_zfs_volumes.go
+++ b/lxd/storage/drivers/driver_zfs_volumes.go
@@ -1109,7 +1109,7 @@ func (d *zfs) UnmountVolume(vol Volume, op *operations.Operation) (bool, error)
 	// Check if still mounted.
 	if shared.IsMountPoint(mountPath) {
 		// Unmount the dataset.
-		_, err := shared.RunCommand("zfs", "unmount", dataset)
+		err := TryUnmount(mountPath, 0)
 		if err != nil {
 			return false, err
 		}


More information about the lxc-devel mailing list