diff options
author | Christoph Hellwig <hch@lst.de> | 2010-01-17 12:32:30 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-20 08:51:11 -0600 |
commit | 1d44952fc7f4de113eae892401e4d50ee476e82e (patch) | |
tree | debaaf6cfbbabf9ae90844da20431b6e8c774446 | |
parent | 23fabed13645fdf66473e458f318baa63be56b22 (diff) |
block: fix cache flushing in bdrv_commit
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | block.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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; } /* |