diff mbox

[09/20] block: Handle flush error in bdrv_pwrite_sync()

Message ID 1458325289-17848-10-git-send-email-kwolf@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kevin Wolf March 18, 2016, 6:21 p.m. UTC
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>
---
 block/io.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Max Reitz March 26, 2016, 6:46 p.m. UTC | #1
On 18.03.2016 19:21, Kevin Wolf wrote:
> 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>
> ---
>  block/io.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox

Patch

diff --git a/block/io.c b/block/io.c
index 41d954ca..575da22 100644
--- a/block/io.c
+++ b/block/io.c
@@ -745,9 +745,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;