Skip to content

Commit 4ba28b9

Browse files
committed
efi: add func run_sync() after apply_diff()
Get pointer according to https://github.com/coreos/bootupd/pull/855/files#r2045400178 ``` Run a sync after apply_diff rather than immediately unmounting and only umount after the sync is done. ```
1 parent 78cb478 commit 4ba28b9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/efi.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ impl Component for Efi {
291291
log::trace!("applying adoption diff: {}", &diff);
292292
filetree::apply_diff(&updated, &esp, &diff, None)
293293
.context("applying filesystem changes")?;
294+
run_sync()?;
294295
self.unmount().context("unmount after adopt")?;
295296
}
296297
Ok(InstalledContent {
@@ -380,6 +381,7 @@ impl Component for Efi {
380381
log::trace!("applying diff: {}", &diff);
381382
filetree::apply_diff(&updated, &destdir, &diff, None)
382383
.context("applying filesystem changes")?;
384+
run_sync()?;
383385
self.unmount().context("unmount after update")?;
384386
}
385387
let adopted_from = None;
@@ -497,6 +499,15 @@ impl Drop for Efi {
497499
}
498500
}
499501

502+
// Run sync after apply_diff()
503+
fn run_sync() -> Result<()> {
504+
Command::new("sync")
505+
.run()
506+
.with_context(|| format!("Failed to run sync"))?;
507+
log::trace!("Sync");
508+
Ok(())
509+
}
510+
500511
fn validate_esp_fstype(dir: &openat::Dir) -> Result<()> {
501512
let dir = unsafe { BorrowedFd::borrow_raw(dir.as_raw_fd()) };
502513
let stat = rustix::fs::fstatfs(&dir)?;

0 commit comments

Comments
 (0)