From patchwork Thu Mar 11 16:55:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 47345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id ABF89B7D12 for ; Fri, 12 Mar 2010 04:14:35 +1100 (EST) Received: from localhost ([127.0.0.1]:35312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nplt3-0000XV-Nv for incoming@patchwork.ozlabs.org; Thu, 11 Mar 2010 12:09:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nplg7-0004tq-LB for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:07 -0500 Received: from [199.232.76.173] (port=35551 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nplg5-0004sJ-PE for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:05 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nplfx-0003ny-Ua for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19908) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nplfw-0003nQ-94 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:55:56 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2BGtseH020448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Mar 2010 11:55:54 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2BGtoNi002794; Thu, 11 Mar 2010 11:55:54 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 11 Mar 2010 17:55:35 +0100 Message-Id: <45ea53fc070c1f076583945a62b18da10ee9687a.1268326362.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 01/16] migration: Clear fd also in error cases X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Not clearing the fd and closing the file makes qemu spin using 100%CPU after incoming migration error. See for instance bug: https://bugzilla.redhat.com/show_bug.cgi?id=518032 Signed-off-by: Juan Quintela --- migration-exec.c | 4 ++-- migration-fd.c | 4 ++-- migration-tcp.c | 5 ++--- migration-unix.c | 5 ++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/migration-exec.c b/migration-exec.c index 3edc026..6ff8449 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -120,12 +120,12 @@ static void exec_accept_incoming_migration(void *opaque) } qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); - /* we've successfully migrated, close the fd */ - qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); + if (autostart) vm_start(); err: + qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); qemu_fclose(f); } diff --git a/migration-fd.c b/migration-fd.c index 0cc74ad..9cf52ce 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -113,12 +113,12 @@ static void fd_accept_incoming_migration(void *opaque) } qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); - /* we've successfully migrated, close the fd */ - qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); + if (autostart) vm_start(); err: + qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); qemu_fclose(f); } diff --git a/migration-tcp.c b/migration-tcp.c index e7f307c..95ce722 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -170,15 +170,14 @@ static void tcp_accept_incoming_migration(void *opaque) qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); - /* we've successfully migrated, close the server socket */ - qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); - close(s); if (autostart) vm_start(); out_fopen: qemu_fclose(f); out: + qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); + close(s); close(c); } diff --git a/migration-unix.c b/migration-unix.c index b7aab38..ce59a2a 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -176,13 +176,12 @@ static void unix_accept_incoming_migration(void *opaque) qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); - /* we've successfully migrated, close the server socket */ - qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); - close(s); out_fopen: qemu_fclose(f); out: + qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); + close(s); close(c); }