aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-01-17 12:32:30 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-20 08:51:11 -0600
commit1d44952fc7f4de113eae892401e4d50ee476e82e (patch)
treedebaaf6cfbbabf9ae90844da20431b6e8c774446 /block.c
parent23fabed13645fdf66473e458f318baa63be56b22 (diff)
block: fix cache flushing in bdrv_commit
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/block.c b/block.c
index f90e9837da..73c26ec410 100644
--- a/block.c
+++ b/block.c
@@ -557,6 +557,7 @@ int bdrv_commit(BlockDriverState *bs)
BlockDriver *drv = bs->drv;
int64_t i, total_sectors;
int n, j;
+ int ret = 0;
unsigned char sector[512];
if (!drv)
@@ -588,8 +589,10 @@ int bdrv_commit(BlockDriverState *bs)
}
}
- if (drv->bdrv_make_empty)
- return drv->bdrv_make_empty(bs);
+ if (drv->bdrv_make_empty) {
+ ret = drv->bdrv_make_empty(bs);
+ bdrv_flush(bs);
+ }
/*
* Make sure all data we wrote to the backing device is actually
@@ -597,7 +600,7 @@ int bdrv_commit(BlockDriverState *bs)
*/
if (bs->backing_hd)
bdrv_flush(bs->backing_hd);
- return 0;
+ return ret;
}
/*