From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id BC6A71FF13E for ; Fri, 06 Feb 2026 12:06:47 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0BFF125417; Fri, 6 Feb 2026 12:07:20 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [PATCH container] fix #7271: exclude non-volume mountpoints from attribute preservation Date: Fri, 6 Feb 2026 12:02:41 +0100 Message-ID: <20260206110714.204791-1-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770375958117 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 65RG7IURADDOIBP5ST4OKUGSGJGUXKPT X-Message-ID-Hash: 65RG7IURADDOIBP5ST4OKUGSGJGUXKPT X-MailFrom: d.kral@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The commit 0db5595 (mountpoint_insert_staged: inherit attributes if directory already exists) allows preserving attributes of the underlying directory that is used as the mount target. Subsequently, the commit abebdaa (fix #7267: do not inherit host attributes for rootfs) excludes the rootdir with the $keep_attrs argument from this preservation. As bind mountpoints might not support chaning the file permissions and/or ownership, e.g. NFS shares, containers with such bind mounts fail to start. Therefore, further exclude any non-volume mountpoints as these are managed externally. Signed-off-by: Daniel Kral --- Tested this with a debian container and a volume mountpoint, a bind-mounted subdirectory on the host and a bind-mounted NFS share. src/PVE/LXC.pm | 6 +++++- src/lxc-pve-prestart-hook | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index b45490b..6cdc80e 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -2473,7 +2473,11 @@ sub mountpoint_hotplug : prototype($$$$$) { chdir('/') or die "failed to change root directory within the container's mount namespace: $!\n"; - mountpoint_insert_staged($mount_fd, undef, $mp->{mp}, $opt, $root_uid, $root_gid, 1); + my $keep_attrs = $mp->{type} eq 'volume'; + + mountpoint_insert_staged( + $mount_fd, undef, $mp->{mp}, $opt, $root_uid, $root_gid, $keep_attrs, + ); }); } diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook index d264ab9..f900c12 100755 --- a/src/lxc-pve-prestart-hook +++ b/src/lxc-pve-prestart-hook @@ -100,7 +100,7 @@ PVE::LXC::Tools::lxc_hook( # Mount relative to the rootdir fd. $dest_base_fd = $rootdir_fd; $dest_dir = './' . $mountpoint->{mp}; - $keep_attrs = 1; + $keep_attrs = $mountpoint->{type} eq 'volume'; } else { # Assert that 'rootfs' is the first one: die "foreach_mount() error\n" if $opt ne 'rootfs'; -- 2.47.3