proxmox-rrd: use syncfs after writing rrd files

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer committed 2021-10-19 11:17:09 +02:00
1 parent bd10af6eda
commit 98eb435d90
6 files changed
+31 -2

No files matched your search

+11
View File
@@ -3,6 +3,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use std::io::{Write, BufReader};
use std::ffi::OsStr;
use std::os::unix::io::AsRawFd;
use anyhow::Error;
use nix::fcntl::OFlag;
@@ -50,6 +51,16 @@ impl JournalState {
})
}
pub fn sync_journal(&self) -> Result<(), Error> {
nix::unistd::fdatasync(self.journal.as_raw_fd())?;
Ok(())
}
pub fn syncfs(&self) -> Result<(), nix::Error> {
let res = unsafe { libc::syncfs(self.journal.as_raw_fd()) };
nix::errno::Errno::result(res).map(drop)
}
pub fn append_journal_entry(
&mut self,
time: f64,