[lxc-devel] [lxd/master] dir: Unfreeze on rsync error

leonklingele on Github lxc-bot at linuxcontainers.org
Mon Jun 12 16:25:12 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 382 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170612/7497b717/attachment.bin>
-------------- next part --------------
From 47ed6d9f378f74165f253f37d917c81179edcdf0 Mon Sep 17 00:00:00 2001
From: Leon Klingele <git at leonklingele.de>
Date: Mon, 12 Jun 2017 18:23:09 +0200
Subject: [PATCH] dir: unfreeze on rsync error

This ensures that we unfreeze the container even if rsync fails
for some reason.
---
 lxd/storage_dir.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 691390b41..2e801c55d 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -609,13 +609,12 @@ func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, source
 			logger.Errorf("Trying to freeze and rsync again failed.")
 			goto onSuccess
 		}
+		defer sourceContainer.Unfreeze()
 
 		err = rsync(snapshotContainer, sourceContainerMntPoint, targetContainerMntPoint, bwlimit)
 		if err != nil {
 			return err
 		}
-
-		defer sourceContainer.Unfreeze()
 	}
 
 onSuccess:


More information about the lxc-devel mailing list