From 3947809c366a555f9ba05f12e55b41609a4c41ef Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 20 May 2020 10:52:13 +0100 Subject: [PATCH] vm-virtio: block: Ensure that VIRTIO_BLK_T_FLUSH requests actually sync The implementation of this virtio block (and vhost-user block) command called a function that was a no-op on Linux. Use the same function as virtio-pmem to ensure that data is not lost when the guest asks for it to be flused to disk. Fixes: #399 Signed-off-by: Rob Bradford --- vm-virtio/src/block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm-virtio/src/block.rs b/vm-virtio/src/block.rs index b009ba41d..7b4faacbf 100755 --- a/vm-virtio/src/block.rs +++ b/vm-virtio/src/block.rs @@ -351,7 +351,7 @@ impl Write for RawFile { } fn flush(&mut self) -> std::io::Result<()> { - self.file.flush() + self.file.sync_all() } }