diff options
author | Daniel Verkamp <dverkamp@chromium.org> | 2019-05-28 12:43:38 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-29 06:27:33 -0700 |
commit | ca39ac0a95f5e2c801903e12070c69a35824becc (patch) | |
tree | d800d99e19b676679f40f0077e18306bbf67c723 | |
parent | 7ec58fafbace41df54b439f9239edc9e9e12d3b7 (diff) | |
download | crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.tar crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.tar.gz crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.tar.bz2 crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.tar.lz crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.tar.xz crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.tar.zst crosvm-ca39ac0a95f5e2c801903e12070c69a35824becc.zip |
devices: block: issue fsync when FlushTimer expires
The RequestType::Flush handler correctly uses fsync(), which issues an fsync to the underlying disk image file. However, the flush timer (started on write and cancelled if a flush request is executed) was only calling flush(), which is insufficient when the disk image is a raw file - it just flushes in-memory buffers and does not issue an fsync. BUG=None TEST=Issue writes in crosvm; verify fsync in strace output Change-Id: I1de8a35615031b5fdf5599dd6b49015d0b245c31 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1632876 Tested-by: kokoro <noreply+kokoro@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
-rw-r--r-- | devices/src/virtio/block.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/devices/src/virtio/block.rs b/devices/src/virtio/block.rs index b0b5c2f..17a5723 100644 --- a/devices/src/virtio/block.rs +++ b/devices/src/virtio/block.rs @@ -747,7 +747,7 @@ impl<T: DiskFile> Worker<T> { for event in events.iter_readable() { match event.token() { Token::FlushTimer => { - if let Err(e) = self.disk_image.flush() { + if let Err(e) = self.disk_image.fsync() { error!("Failed to flush the disk: {}", e); break 'poll; } |