From patchwork Tue Mar 9 23:10: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: 47196 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 045B0B7D19 for ; Wed, 10 Mar 2010 10:13:43 +1100 (EST) Received: from localhost ([127.0.0.1]:50286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Np8cN-0007zQ-VP for incoming@patchwork.ozlabs.org; Tue, 09 Mar 2010 18:13:40 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Np8ZX-0005h1-67 for qemu-devel@nongnu.org; Tue, 09 Mar 2010 18:10:43 -0500 Received: from [199.232.76.173] (port=40146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Np8ZW-0005gV-NC for qemu-devel@nongnu.org; Tue, 09 Mar 2010 18:10:42 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Np8ZV-0006Bg-Eo for qemu-devel@nongnu.org; Tue, 09 Mar 2010 18:10:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26551) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Np8ZV-0006BR-0g for qemu-devel@nongnu.org; Tue, 09 Mar 2010 18:10:41 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o29NAdQl022298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Mar 2010 18:10:40 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o29NAaVx021877; Tue, 9 Mar 2010 18:10:38 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 10 Mar 2010 00:10:35 +0100 Message-Id: <45ea53fc070c1f076583945a62b18da10ee9687a.1268176134.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 1/2] 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); }