From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6D6A41FF140 for ; Fri, 24 Apr 2026 11:36:39 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 411541189A; Fri, 24 Apr 2026 11:36:39 +0200 (CEST) Date: Fri, 24 Apr 2026 11:36:00 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= Subject: applied: [PATCH proxmox] shared-memory: flush contents of newly created mmap file To: Christian Ebner , pbs-devel@lists.proxmox.com References: <20260422073351.181581-1-c.ebner@proxmox.com> In-Reply-To: <20260422073351.181581-1-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1777023327.kj44okrld4.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777023272934 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 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 KAM_SHORT 0.001 Use of a URL Shortener for very short URL SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lib.rs] Message-ID-Hash: H2TUR6HTEAYP2N2Z7L65C7LMCUJLMJNW X-Message-ID-Hash: H2TUR6HTEAYP2N2Z7L65C7LMCUJLMJNW X-MailFrom: f.gruenbichler@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: just FTR, this one got applied already in acd33a15c29cfe617ce5ecc69c78f692b2f20a8b On April 22, 2026 9:33 am, Christian Ebner wrote: > The man page for mmap [0] states, that mappings create with > `MAP_SHARED` are not carried to the underlying file directly. >=20 > To avoid possible races between creating and initializing a new > mmapped file and opening while checking the header of this file, > msync the contents after init but before persisting the shared > memory backed file. >=20 > [0] https://man7.org/linux/man-pages/man2/mmap.2.html >=20 > Fixes: https://forum.proxmox.com/threads/182948/ > Signed-off-by: Christian Ebner > --- > proxmox-shared-memory/src/lib.rs | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/proxmox-shared-memory/src/lib.rs b/proxmox-shared-memory/src= /lib.rs > index 495812ef..4838ab42 100644 > --- a/proxmox-shared-memory/src/lib.rs > +++ b/proxmox-shared-memory/src/lib.rs > @@ -190,6 +190,10 @@ impl SharedMemory { > =20 > let mmap =3D mmap_file(&mut file, true)?; > =20 > + if skip_tmpfs_check { > + mmap.msync(MsFlags::MS_SYNC)?; > + } > + > let res =3D { > let path =3D CString::new(path.as_os_str().as_bytes())?; > Errno::result(unsafe { > --=20 > 2.47.3 >=20 >=20 >=20 >=20 >=20 >=20