mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-28 19:29:20 +00:00
devices: block: sync after setting refcount
Make sure that the refcount update is commited to disk before we start to write data to the cluster. Change-Id: Ibdf5dde7a75c3582f87df46af1095c7dc0007d98 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1136019 Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
parent
6fd0c6f223
commit
5ad21740e4
1 changed files with 2 additions and 0 deletions
|
@ -411,6 +411,8 @@ impl QcowFile {
|
|||
self.file.sync_data()?;
|
||||
// The cluster refcount starts at one indicating it is used but doesn't need COW.
|
||||
self.set_cluster_refcount(new_addr, 1)?;
|
||||
// Ensure that the refcount is updated before starting to use the cluster.
|
||||
self.file.sync_data()?;
|
||||
Ok(new_addr)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue