From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup] pbs-key-config: align fsync behavior when storing new/existing key
Date: Tue, 24 Mar 2026 11:04:13 +0100 [thread overview]
Message-ID: <20260324100413.215443-1-c.ebner@proxmox.com> (raw)
In case a key is stored by replacing the file contents, the file
contents are synced to disk as the corresponding flag is set for
proxmox-sys::fs::replace_file(). When creating a new file however,
fsync is never called.
Align the behaviour by also calling fsync in case of storing the key
to a new file.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
Noticed while evaluating to reuse this method to store key
information to be used by push sync jobs.
pbs-key-config/src/lib.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pbs-key-config/src/lib.rs b/pbs-key-config/src/lib.rs
index 0bcd5338c..71a49dd78 100644
--- a/pbs-key-config/src/lib.rs
+++ b/pbs-key-config/src/lib.rs
@@ -1,5 +1,6 @@
use std::io::Write;
use std::path::Path;
+use std::os::fd::AsRawFd;
use anyhow::{bail, format_err, Context, Error};
use serde::{Deserialize, Serialize};
@@ -254,6 +255,7 @@ impl KeyConfig {
.open(path)?;
file.write_all(data.as_bytes())?;
+ nix::unistd::fsync(file.as_raw_fd())?;
}
Ok(())
--
2.47.3
next reply other threads:[~2026-03-24 10:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 10:04 Christian Ebner [this message]
2026-03-24 13:17 ` Fabian Grünbichler
2026-03-24 13:30 ` Christian Ebner
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=20260324100413.215443-1-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox