summaryrefslogtreecommitdiff
path: root/block/vhdx-log.c
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2017-08-07 08:38:21 -0400
committerKevin Wolf <kwolf@redhat.com>2017-08-08 14:37:00 +0200
commitc6572fa0d2b81bc3a9ca5716f975f2bf59c62e6c (patch)
treedd71acf5937cb281ab80dc50774f56b6f4b5a4da /block/vhdx-log.c
parent27539ac53154cf9da6990ce9bec1064d37cf2b1d (diff)
downloadqemu-c6572fa0d2b81bc3a9ca5716f975f2bf59c62e6c.tar.gz
block/vhdx: check error return of bdrv_flush()
Reported-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vhdx-log.c')
-rw-r--r--block/vhdx-log.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
index 95972230f0..a27dc059cd 100644
--- a/block/vhdx-log.c
+++ b/block/vhdx-log.c
@@ -565,7 +565,10 @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
desc_entries = NULL;
}
- bdrv_flush(bs);
+ ret = bdrv_flush(bs);
+ if (ret < 0) {
+ goto exit;
+ }
/* once the log is fully flushed, indicate that we have an empty log
* now. This also sets the log guid to 0, to indicate an empty log */
vhdx_log_reset(bs, s);
@@ -1039,7 +1042,11 @@ int vhdx_log_write_and_flush(BlockDriverState *bs, BDRVVHDXState *s,
/* Make sure data written (new and/or changed blocks) is stable
* on disk, before creating log entry */
- bdrv_flush(bs);
+ ret = bdrv_flush(bs);
+ if (ret < 0) {
+ goto exit;
+ }
+
ret = vhdx_log_write(bs, s, data, length, offset);
if (ret < 0) {
goto exit;
@@ -1047,7 +1054,11 @@ int vhdx_log_write_and_flush(BlockDriverState *bs, BDRVVHDXState *s,
logs.log = s->log;
/* Make sure log is stable on disk */
- bdrv_flush(bs);
+ ret = bdrv_flush(bs);
+ if (ret < 0) {
+ goto exit;
+ }
+
ret = vhdx_log_flush(bs, s, &logs);
if (ret < 0) {
goto exit;