From: Christian Ebner <c.ebner@proxmox.com>
To: Robert Obkircher <r.obkircher@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup 3/4] datastore: move try_ensure_sync_level() to DataStoreImpl
Date: Mon, 11 May 2026 14:53:49 +0200 [thread overview]
Message-ID: <99ef77bc-0a75-4dfb-8c8f-0c9ae6a1016d@proxmox.com> (raw)
In-Reply-To: <1b037d5b-8dca-479d-a6f3-79a96d6e5b60@proxmox.com>
On 5/11/26 11:21 AM, Robert Obkircher wrote:
>
> On 08.05.26 14:28, Christian Ebner wrote:
>> Keep the public interface in place, but move the method to
>> DataStoreImpl so it can be reused from the inner context as well.
>>
>> This is in preparation for fixing the sync level updates not being
>> propagated to the chunk store.
>>
>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>> ---
>> pbs-datastore/src/datastore.rs | 24 ++++++++++++++----------
>> 1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
>> index bc218cb94..8f69dd7ac 100644
>> --- a/pbs-datastore/src/datastore.rs
>> +++ b/pbs-datastore/src/datastore.rs
>> @@ -234,6 +234,19 @@ impl DataStoreImpl {
>> thresholds_exceeded_callback: None,
>> })
>> }
>> +
>> + fn try_ensure_sync_level(&self) -> Result<(), Error> {
>> + if self.sync_level != DatastoreFSyncLevel::Filesystem {
> If the level in the chunk store changes from File to Filesystem this
> still wouldn't sync the chunks that have been written afterwards.
>
> It may be better to just move the entire method into the chunk store.
Good catch! Agreed that this should be fixed by moving the
implementation to the chunk store.
>> + return Ok(());
>> + }
>> + let file = std::fs::File::open(self.chunk_store.base_path())?;
>> + let fd = file.as_raw_fd();
>> + log::info!("syncing filesystem");
>> + if unsafe { libc::syncfs(fd) } < 0 {
>> + bail!("error during syncfs: {}", std::io::Error::last_os_error());
>> + }
>> + Ok(())
>> + }
>> }
>>
>> pub type ThresholdsExceededCallback = fn(&str, &str, u64, u64) -> Result<(), Error>;
>> @@ -3015,16 +3028,7 @@ impl DataStore {
>> /// Syncs the filesystem of the datastore if 'sync_level' is set to
>> /// [`DatastoreFSyncLevel::Filesystem`]. Uses syncfs(2).
>> pub fn try_ensure_sync_level(&self) -> Result<(), Error> {
>> - if self.inner.sync_level != DatastoreFSyncLevel::Filesystem {
>> - return Ok(());
>> - }
>> - let file = std::fs::File::open(self.base_path())?;
>> - let fd = file.as_raw_fd();
>> - log::info!("syncing filesystem");
>> - if unsafe { libc::syncfs(fd) } < 0 {
>> - bail!("error during syncfs: {}", std::io::Error::last_os_error());
>> - }
>> - Ok(())
>> + self.inner.try_ensure_sync_level()
>> }
>>
>> /// Destroy a datastore. This requires that there are no active operations on the datastore.
next prev parent reply other threads:[~2026-05-11 12:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 12:29 [PATCH proxmox-backup 0/4] fix sync level updates for chunk store Christian Ebner
2026-05-08 12:29 ` [PATCH proxmox-backup 1/4] datastore: restrict chunk store mutex scope to crate only Christian Ebner
2026-05-08 12:29 ` [PATCH proxmox-backup 2/4] datastore: avoid useless double borrowing of datastore Christian Ebner
2026-05-08 12:29 ` [PATCH proxmox-backup 3/4] datastore: move try_ensure_sync_level() to DataStoreImpl Christian Ebner
2026-05-11 9:23 ` Robert Obkircher
2026-05-11 12:53 ` Christian Ebner [this message]
2026-05-08 12:29 ` [PATCH proxmox-backup 4/4] datastore: fix sync level update propagation to chunk store Christian Ebner
2026-05-11 9:25 ` Robert Obkircher
2026-05-11 12:56 ` Christian Ebner
2026-05-12 8:56 ` [PATCH proxmox-backup 0/4] fix sync level updates for " 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=99ef77bc-0a75-4dfb-8c8f-0c9ae6a1016d@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=r.obkircher@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