diff mbox

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

Message ID 1360534366-26723-4-git-send-email-stefanha@redhat.com
State New
Headers show

Commit Message

Stefan Hajnoczi Feb. 10, 2013, 10:12 p.m. UTC
The .save_live_iterate() function returns 0 to 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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini Feb. 11, 2013, 10:17 a.m. UTC | #1
Il 10/02/2013 23:12, Stefan Hajnoczi ha scritto:
> The .save_live_iterate() function returns 0 to 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 | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/block-migration.c b/block-migration.c
> index a91d96b..bcd0039 100644
> --- a/block-migration.c
> +++ b/block-migration.c
> @@ -582,7 +582,12 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
>  
>      qemu_put_be64(f, BLK_MIG_FLAG_EOS);
>  
> -    return 0;
> +    /* Complete when bulk transfer is done and all dirty blocks have been
> +     * transferred.
> +     */
> +    return block_mig_state.bulk_completed &&
> +           block_mig_state.submitted == 0 &&
> +           block_mig_state.read_done == 0;
>  }
>  
>  static int block_save_complete(QEMUFile *f, void *opaque)
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox

Patch

diff --git a/block-migration.c b/block-migration.c
index a91d96b..bcd0039 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -582,7 +582,12 @@  static int block_save_iterate(QEMUFile *f, void *opaque)
 
     qemu_put_be64(f, BLK_MIG_FLAG_EOS);
 
-    return 0;
+    /* Complete when bulk transfer is done and all dirty blocks have been
+     * transferred.
+     */
+    return block_mig_state.bulk_completed &&
+           block_mig_state.submitted == 0 &&
+           block_mig_state.read_done == 0;
 }
 
 static int block_save_complete(QEMUFile *f, void *opaque)