[pve-devel] [RFC pve-container] vzdump: don't unmount filesystems with -mode suspend

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Sep 16 15:24:12 CEST 2015


a) it doesn't make sense
b) while a plain umount fails on things like
  /proc/$ctpid/root/proc, using -l weirdly causes a command
  like this to unmount the *host's* /proc, which is
  generally not a good idea...
---
 src/PVE/VZDump/LXC.pm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index a2338ce..569c4f8 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -135,6 +135,7 @@ sub prepare {
 	&$check_mountpoint_empty($rootdir);
     } elsif ($mode eq 'suspend') {
 	my $pid = PVE::LXC::find_lxc_pid($vmid);
+	$task->{no_unmount} = 1;
 	foreach my $disk (@$disks) {
 	    $disk->{dir} = "/proc/$pid/root$disk->{mp}";
 	}
@@ -294,10 +295,12 @@ sub cleanup {
 
     my $conf = PVE::LXC::load_config($vmid);
 
-    my $rootdir = $default_mount_point;
-    my $disks = $task->{disks};
-    foreach my $disk (reverse @$disks) {
-	PVE::Tools::run_command(['umount', '-l', '-d', $disk->{dir}]) if $disk->{dir};
+    if (!$task->{no_unmount}) {
+	my $rootdir = $default_mount_point;
+	my $disks = $task->{disks};
+	foreach my $disk (reverse @$disks) {
+	    PVE::Tools::run_command(['umount', '-l', '-d', $disk->{dir}]) if $disk->{dir};
+	}
     }
 
     if ($task->{cleanup}->{remove_snapshot}) {
-- 
2.1.4




More information about the pve-devel mailing list