Received: from eggs.gnu.org ([2001:4830:134:3::10]:44811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnTIS-0005tG-6M for qemu-devel@nongnu.org; Mon, 02 Dec 2013 08:12:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnTI2-0001S1-5R for qemu-devel@nongnu.org; Mon, 02 Dec 2013 08:12:20 -0500 Received: from [123.126.109.238] (port=16887 helo=a480.site) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnTI1-0001Qz-Nh for qemu-devel@nongnu.org; Mon, 02 Dec 2013 08:11:54 -0500 From: Lin Ma Date: Sun, 1 Dec 2013 23:24:22 +0800 Message-Id: <1385911462-3958-1-git-send-email-lma@suse.com> Subject: [Qemu-devel] [PATCH] Fix incorect state information for migrate_cancel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Lin Ma 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 --- 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); -- 1.8.4