From patchwork Fri Dec 6 01:49:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ma X-Patchwork-Id: 297516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6AB232C009A for ; Fri, 6 Dec 2013 12:49:54 +1100 (EST) Received: from localhost ([::1]:56945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VokYA-00077m-NP for incoming@patchwork.ozlabs.org; Thu, 05 Dec 2013 20:49:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VokXq-00077Q-Jr for qemu-devel@nongnu.org; Thu, 05 Dec 2013 20:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VokXg-0007pk-8I for qemu-devel@nongnu.org; Thu, 05 Dec 2013 20:49:30 -0500 Received: from soto.provo.novell.com ([137.65.250.214]:60425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VokXf-0007pZ-WD for qemu-devel@nongnu.org; Thu, 05 Dec 2013 20:49:20 -0500 Received: from INET-RELAY2-MTA by soto.provo.novell.com with Novell_GroupWise; Thu, 05 Dec 2013 18:49:18 -0700 Message-Id: <52A1C7CB02000062000436B1@soto.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 12.0.2 Date: Thu, 05 Dec 2013 18:49:15 -0700 From: "Lin Ma" To: Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 137.65.250.214 Cc: pbonzini@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH] Fix incorrect state information for migrate_cancel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);