Patchwork [for-1.4,stable,3/3] block-migration: fix block_save_iterate() return value

login
register
mail settings
Submitter Stefan Hajnoczi
Date Feb. 9, 2013, 6:01 p.m.
Message ID <1360432919-1379-4-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/219415/
State New
Headers show

Comments

Stefan Hajnoczi - Feb. 9, 2013, 6:01 p.m.
The .save_live_iterate() function returns 0 it continue iterating or 1
to stop iterating.

Since 16310a3cca7320edb9341c976f7819de0a8c27e0 it only ever returns 0,
leading to an infinite loop.

Return 1 if we have finished sending dirty blocks.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block-migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Juan Quintela - Feb. 11, 2013, 12:57 p.m.
Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The .save_live_iterate() function returns 0 it continue iterating or 1
> to stop iterating.
>
> Since 16310a3cca7320edb9341c976f7819de0a8c27e0 it only ever returns 0,
> leading to an infinite loop.
>
> Return 1 if we have finished sending dirty blocks.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Patch

diff --git a/block-migration.c b/block-migration.c
index a91d96b..e9bc200 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -582,7 +582,7 @@  static int block_save_iterate(QEMUFile *f, void *opaque)
 
     qemu_put_be64(f, BLK_MIG_FLAG_EOS);
 
-    return 0;
+    return get_remaining_dirty() == 0;
 }
 
 static int block_save_complete(QEMUFile *f, void *opaque)