[pve-devel] [PATCH container v2] sync_container_namespace: skip virtual filesystems

Stoiko Ivanov s.ivanov at proxmox.com
Fri Sep 18 14:16:21 CEST 2020


skip additional virtual filesystems.

the list is taken from a running debian container's /proc/mounts

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
v1 -> v2:
* changed the non-anchored unwieldy regex to a hash based on Thomas' suggestion
  - Thanks!

 src/PVE/LXC.pm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index b3e3581..9c150d9 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1103,11 +1103,24 @@ my $do_syncfs = sub {
     my $mountdata = do { local $/ = undef; <$socket> };
     close $socket;
 
+    my %nosyncfs = (
+	cgroup => 1,
+	cgroup2 => 1,
+	devtmpfs => 1,
+	devpts => 1,
+	'fuse.lxcfs' => 1,
+	fusectl => 1,
+	mqueue => 1,
+	proc => 1,
+	sysfs => 1,
+	tmpfs => 1,
+    );
+
     # Now sync all mountpoints...
     my $mounts = PVE::ProcFSTools::parse_mounts($mountdata);
     foreach my $mp (@$mounts) {
 	my ($what, $dir, $fs) = @$mp;
-	next if $fs eq 'fuse.lxcfs';
+	next if $nosyncfs{$fs};
 	eval { PVE::Tools::sync_mountpoint($dir); };
 	warn $@ if $@;
     }
-- 
2.20.1






More information about the pve-devel mailing list