proxmox-rrd: use syncfs after writing rrd files
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
11
proxmox-rrd/src/cache/journal.rs
vendored
11
proxmox-rrd/src/cache/journal.rs
vendored
@ -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,
|
||||
|
Reference in New Issue
Block a user