aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-11-05 00:03:15 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2016-11-08 16:06:35 +0000
commite6af1e085416378918cca357bf2abd8b90224667 (patch)
tree721eaab75a6195c3191965ae4a0f351328272f8d /block
parent207faf24c58859f5240f66bf6decc33b87a1776e (diff)
block: Don't mark node clean after failed flush
Commit 3ff2f67a changed bdrv_co_flush() so that no flush is issues if the image hasn't been dirtied since the last flush. This is not quite correct: The condition should be that the image hasn't been dirtied since the last _successful_ flush. This patch changes the logic accordingly. Without this fix, subsequent bdrv_co_flush() calls would return success without actually doing anything even though the image is still dirty. The difference is visible in some blkdebug test cases where error messages incorrectly disappeared after commit 3ff2f67a. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 1478300595-10090-1-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/io.c b/block/io.c
index 37749b680a..aa532a5c1f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2372,7 +2372,9 @@ flush_parent:
ret = bs->file ? bdrv_co_flush(bs->file->bs) : 0;
out:
/* Notify any pending flushes that we have completed */
- bs->flushed_gen = current_gen;
+ if (ret == 0) {
+ bs->flushed_gen = current_gen;
+ }
bs->active_flush_req = false;
/* Return value is ignored - it's ok if wait queue is empty */
qemu_co_queue_next(&bs->flush_queue);