proxmox-rrd: use syncfs after writing rrd files

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-10-18 13:45:30 +02:00
parent bd10af6eda
commit 98eb435d90
6 changed files with 31 additions and 2 deletions

View File

@ -147,6 +147,10 @@ impl RRDCache {
Ok(JournalEntry { time, value, dst, rel_path })
}
pub fn sync_journal(&self) -> Result<(), Error> {
self.state.read().unwrap().sync_journal()
}
/// Apply and commit the journal. Should be used at server startup.
pub fn apply_journal(&self) -> Result<bool, Error> {
let state = Arc::clone(&self.state);
@ -387,6 +391,8 @@ fn commit_journal_impl(
}
}
state.read().unwrap().syncfs()?;
if errors != 0 {
bail!("errors during rrd flush - unable to commit rrd journal");
}