From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: [pve-devel] applied: [PATCH container 2/2] mountpoint_insert_staged: inherit attributes if directory already exists
Date: Thu, 15 Jan 2026 13:58:31 +0100 [thread overview]
Message-ID: <1768481898.y0yfrfcvip.astroid@yuna.none> (raw)
In-Reply-To: <20251216180904.270167-3-f.schauer@proxmox.com>
after bumping pve-common. thanks!
On December 16, 2025 7:08 pm, Filip Schauer wrote:
> Make mount points inherit the uid, gid, and access mode if the directory
> already exists in the container file system. This makes setting up mount
> points more convenient when attributes different from uid=0, gid=0,
> mode=755 are required.
>
> As an example, this ensures that directories like /app/data and
> /app/cache in the docker.io/weblate/weblate OCI image retain the correct
> permissions when adding mount points over them.
>
> While not explicitly specified by the OCI spec, this matches the
> behaviour of implementations such as Docker and Podman.
>
> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
> ---
> src/PVE/LXC.pm | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index e5ff3a1..bf4899f 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -2130,6 +2130,13 @@ sub mountpoint_insert_staged {
>
> my $dest_fd = walk_tree_nofollow_fd('/', $rootdir_fd, $mp_dir, 1, $root_uid, $root_gid);
>
> + # Preserve attributes of destination directory
> + my ($mode, $uid, $gid) = (stat($dest_fd))[2, 4, 5];
> + PVE::Tools::fchownat(fileno($mount_fd), '', $uid, $gid, PVE::Tools::AT_EMPTY_PATH)
> + or die "failed to propagate uid and gid to mountpoint: $!\n";
> + PVE::Tools::fchmodat(fileno($mount_fd), '.', $mode, 0)
> + or die "failed to propagate access mode to mountpoint: $!\n";
> +
> PVE::Tools::move_mount(
> fileno($mount_fd),
> '',
> --
> 2.47.3
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2026-01-15 12:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 18:08 [pve-devel] [PATCH common/container 0/2] inherit attributes from preexisting directory during mountpoint setup Filip Schauer
2025-12-16 18:08 ` [pve-devel] [PATCH common 1/2] tools: add fchmodat syscall Filip Schauer
2026-01-15 10:28 ` [pve-devel] applied: " Fabian Grünbichler
2025-12-16 18:08 ` [pve-devel] [PATCH container 2/2] mountpoint_insert_staged: inherit attributes if directory already exists Filip Schauer
2026-01-15 12:58 ` Fabian Grünbichler [this message]
2025-12-17 13:17 ` [pve-devel] [PATCH common/container 0/2] inherit attributes from preexisting directory during mountpoint setup Maximiliano Sandoval
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1768481898.y0yfrfcvip.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.