diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-03-04 14:16:51 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-03-30 12:16:01 +0200 |
commit | 855a6a93a12b60b2799eb5999baabd7a85a37c99 (patch) | |
tree | 541a6821ce8915c6cf4d9511906978be85107cef /block/io.c | |
parent | 72e775c7d9de3eaa35a6edaf9d87cedee149d0f5 (diff) |
block: Handle flush error in bdrv_pwrite_sync()
We don't want to silently ignore a flush error.
Also, there is little point in avoiding the flush for writethrough modes
and once WCE is moved to the BB layer, we definitely need the flush here
because bdrv_pwrite() won't involve one any more.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/io.c b/block/io.c index c8f5401076..b58843594e 100644 --- a/block/io.c +++ b/block/io.c @@ -747,9 +747,9 @@ int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset, return ret; } - /* No flush needed for cache modes that already do it */ - if (bs->enable_write_cache) { - bdrv_flush(bs); + ret = bdrv_flush(bs); + if (ret < 0) { + return ret; } return 0; |