[pve-devel] [PATCH container] Fix #576: Cancelling move disk does not leave useless files anymore

Dominic Jäger d.jaeger at proxmox.com
Thu Jun 6 11:21:31 CEST 2019


When cancelling the move disk operation for containers the partly
finished destination and thus useless files now get removed.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
 src/PVE/LXC.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 62b6b8c..397ca3f 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2024,8 +2024,12 @@ my $copy_volume = sub {
 				 "--bwlimit=$bwlimit", "$src/", $dest]);
     };
     my $err = $@;
+
+    # Wait for rsync's children to release dest
+    while (system("fuser -s $dest") == 0) {sleep 1};
+
     foreach my $mount (reverse @mounted) {
-	eval { PVE::Tools::run_command(['/bin/umount', '--lazy', $mount], errfunc => sub{})};
+	eval { PVE::Tools::run_command(['/bin/umount', $mount], errfunc => sub{})};
 	warn "Can't umount $mount\n" if $@;
     }
 
-- 
2.11.0




More information about the pve-devel mailing list