[pve-devel] [PATCH container] fix bindmounting with staged mount points

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Nov 26 09:03:07 CET 2019


We still passed the target mount path to bindmount() causing
bindmount_verify() to fail. Fix this by assuming '/' as the
in-container target mount path when staging, as we mount
onto the $rootdir instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller 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 5109189..73e54ca 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1519,8 +1519,12 @@ sub __mountpoint_mount {
 	return undef;
     }
 
+    # When staging mount points we always mount to $rootdir directly (iow. as if `mp=/`).
+    # This is required since __mount_prepare_rootdir() will return handles to the parent directory
+    # which we use in __bindmount_verify()!
+    my $mount = $stage_mount ? '/': $mountpoint->{mp};
+
     my $volid = $mountpoint->{volume};
-    my $mount = $mountpoint->{mp};
     my $type = $mountpoint->{type};
     my $quota = !$snapname && !$mountpoint->{ro} && $mountpoint->{quota};
     my $mounted_dev;
-- 
2.20.1





More information about the pve-devel mailing list