Skip to content

Commit 84d7564

Browse files
committed
fix(block): make prepare_save() more robust
If prepare_save() fails to drain the io_uring queues (when used) and sync the host filesystem we might end up with a corrupted disk snapshot. Currently, Firecracker ignores that, only emitting an error message. Be more strict and expect no errors, so that we can have a better post-mortem analysis of what happened. Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
1 parent 1cd9371 commit 84d7564

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • src/vmm/src/devices/virtio/block/virtio

src/vmm/src/devices/virtio/block/virtio/device.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub struct ConfigSpace {
197197
pub max_write_zeroes_seg: u32, // offset 52
198198
pub write_zeroes_may_unmap: u8, // offset 56
199199
pub(crate) _unused1: [u8; 3], // offset 57 (spec field — virtio_blk_config.unused1)
200-
pub(crate) _pad: [u8; 4], // offset 60 (Rust alignment padding to 64; spec ends at 60)
200+
pub(crate) _pad: [u8; 4], // offset 60 (Rust alignment padding to 64; spec ends at 60)
201201
}
202202
const _: () = assert!(std::mem::size_of::<ConfigSpace>() == 64);
203203
// Compile-time guards against accidental layout drift. The byte offsets here
@@ -722,9 +722,10 @@ impl VirtioBlock {
722722
}
723723

724724
fn drain_and_flush(&mut self, discard: bool) {
725-
if let Err(err) = self.disk.file_engine.drain_and_flush(discard) {
726-
error!("Failed to drain ops and flush block data: {:?}", err);
727-
}
725+
self.disk
726+
.file_engine
727+
.drain_and_flush(discard)
728+
.expect("virtio-block: failed to drain ops and flush block data");
728729
}
729730

730731
/// Prepare device for being snapshotted.

0 commit comments

Comments
 (0)