diff mbox

Fix incorrect state information for migrate_cancel

Message ID 52A1C7CB02000062000436B1@soto.provo.novell.com
State New
Headers show

Commit Message

Lin Ma Dec. 6, 2013, 1:49 a.m. UTC
In qemu-1.4.x, When performing migrate_cancel on hmp, Sometimes
s->state is incorrrectly saved to MIG_STATE_ERROR instead of
MIG_STATE_CANCELLED.

If the migrate_fd_cancel in main thread is scheduled to run before
the thread buffered_file_thread calls migrate_fd_put_buffer, The
s->state will be modified to MIG_STATE_CANCELLED by main thread,
Then the migrate_fd_put_buffer in thread buffered_file_thread will
return -EIO if s->state != MIG_STATE_ACTIVE, This incorrect return
value trigged migrate_fd_error to set s->state = MIG_STATE_ERROR.

This patch fixes the issue in qemu-1.4.x.

Signed-off-by: Lin Ma <lma@suse.com>
---
 migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luiz Capitulino Dec. 6, 2013, 2 p.m. UTC | #1
On Thu, 05 Dec 2013 18:49:15 -0700
"Lin Ma" <lma@suse.com> wrote:

> In qemu-1.4.x, When performing migrate_cancel on hmp, Sometimes
> s->state is incorrrectly saved to MIG_STATE_ERROR instead of
> MIG_STATE_CANCELLED.
> 
> If the migrate_fd_cancel in main thread is scheduled to run before
> the thread buffered_file_thread calls migrate_fd_put_buffer, The
> s->state will be modified to MIG_STATE_CANCELLED by main thread,
> Then the migrate_fd_put_buffer in thread buffered_file_thread will
> return -EIO if s->state != MIG_STATE_ACTIVE, This incorrect return
> value trigged migrate_fd_error to set s->state = MIG_STATE_ERROR.
> 
> This patch fixes the issue in qemu-1.4.x.

Is qemu 1.4 still maintained?

> 
> Signed-off-by: Lin Ma <lma@suse.com>
> ---
>  migration.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration.c b/migration.c
> index 98c7696..0ac4608 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -751,7 +751,7 @@ static void *buffered_file_thread(void *opaque)
>      }
>  
>  out:
> -    if (ret < 0) {
> +    if (ret < 0 && !s->complete) {
>          migrate_fd_error(s);
>      }
>      g_free(s->buffer);
diff mbox

Patch

diff --git a/migration.c b/migration.c
index 98c7696..0ac4608 100644
--- a/migration.c
+++ b/migration.c
@@ -751,7 +751,7 @@  static void *buffered_file_thread(void *opaque)
     }
 
 out:
-    if (ret < 0) {
+    if (ret < 0 && !s->complete) {
         migrate_fd_error(s);
     }
     g_free(s->buffer);