From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup] pbs-key-config: align fsync behavior when storing new/existing key
Date: Tue, 24 Mar 2026 14:17:07 +0100 [thread overview]
Message-ID: <1774358207.bh0j523o7r.astroid@yuna.none> (raw)
In-Reply-To: <20260324100413.215443-1-c.ebner@proxmox.com>
On March 24, 2026 11:04 am, Christian Ebner wrote:
> 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())?;
LGTM in principle, though we could also switch to
atomic_open_or_create_file ?
> }
>
> Ok(())
> --
> 2.47.3
>
>
>
>
>
>
next prev parent reply other threads:[~2026-03-24 13:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 10:04 Christian Ebner
2026-03-24 13:17 ` Fabian Grünbichler [this message]
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=1774358207.bh0j523o7r.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=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 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.