Received: from eggs.gnu.org ([2001:4830:134:3::10]:34774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnFv5-0005Jw-52 for qemu-devel@nongnu.org; Sun, 01 Dec 2013 17:55:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnFv0-0008H5-8T for qemu-devel@nongnu.org; Sun, 01 Dec 2013 17:55:19 -0500 Received: from soto.provo.novell.com ([137.65.250.214]:41210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnFuz-0008Gq-VX for qemu-devel@nongnu.org; Sun, 01 Dec 2013 17:55:14 -0500 Message-Id: <529C58FC0200006200043251@soto.provo.novell.com> Date: Sun, 01 Dec 2013 15:55:08 -0700 From: "Lin Ma" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4370875C.0__=" Subject: [Qemu-devel] [PATCH] Fix incorrect state information for migrate_cancel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4370875C.0__= Content-Type: multipart/alternative; boundary="=__Part4370875C.1__=" --=__Part4370875C.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 !=3D MIG_STATE_ACTIVE, This incorrect return value trigged migrate_fd_error to set s->state =3D MIG_STATE_ERROR. This patch fixes the issue in qemu-1.4.x. Signed-off-by: Lin Ma --- 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) } =20 out: - if (ret < 0) { + if (ret < 0 && !s->complete) { migrate_fd_error(s); } g_free(s->buffer); --=20 1.8.4 --=__Part4370875C.1__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML 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_CAN= CELLED by main thread,
Then the migrate_fd_put_buffer in thread = buffered_file_thread will
return -EIO if s->state !=3D MIG_STATE_ACTI= VE, This incorrect return
value trigged migrate_fd_error to set = s->state =3D MIG_STATE_ERROR.

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

Signed-off-by: Lin Ma <lma@suse.com>
---
&nb= sp;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);<= br>     }
     g_free(s->buff= er);
--
1.8.4
--=__Part4370875C.1__=-- --=__Part4370875C.0__=--