It is not completely clear to me what is being flushed in
qcow2_alloc_bytes() but bdrv_flush(bs->file) is probably wrong.  At
least the refcount cache should be flushed since this function calls
update_cluster_refcount().

To be on the safe side, call the full bdrv_flush(bs).  This flushes all
caches and the underlying file itself.

Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
---
 block/qcow2-refcount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 05b5ec9..4ef3dac 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -663,7 +663,7 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
         }
     }
 
-    bdrv_flush(bs->file);
+    bdrv_flush(bs);
     return offset;
 }
 
-- 
1.8.1.2


Reply via email to