From patchwork Tue Aug 7 15:51:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 175677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BFA5C2C0098 for ; Wed, 8 Aug 2012 01:52:54 +1000 (EST) Received: from localhost ([::1]:33449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sym5U-0002et-RM for incoming@patchwork.ozlabs.org; Tue, 07 Aug 2012 11:52:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sym4n-000135-Vz for qemu-devel@nongnu.org; Tue, 07 Aug 2012 11:52:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sym4j-0005Gf-JI for qemu-devel@nongnu.org; Tue, 07 Aug 2012 11:52:09 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:42042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sym4j-0005GN-1R for qemu-devel@nongnu.org; Tue, 07 Aug 2012 11:52:05 -0400 Received: by pbbro12 with SMTP id ro12so7076664pbb.4 for ; Tue, 07 Aug 2012 08:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=TxhKdMr7IvTLSCUdRsBzEL1wQy0Fcc23pNhIHKRomgE=; b=UcqXrE2LmG4CcBSiYXN4t7qmMqheIDtpNnYsaA+Ju2Uise27DWoCYyfWKKiQ6fn8// tOcYn/3du9VWVs33SqyjiJA8K7yK7d0KrnFbLCFpOofx5Hd7XEsFanv4sM8AYJkX8dDw tdJGFVZJ/0ZuJIq8rxbg1wCQ1sYnbrTr1xFPWk1rasjh8oNFi/clT4mtlkboUJtp5N1+ xdVltNUBD+NMVnqRY8kpr4byFGp8CmFADcDWP7PWkiFwL3V9htkYeCEhq6IuphyJNz8R FKI0z+UofosHJ4FY2mKnDgTF8mIsemngXqh6Z56s6GtV19uyCx5yBvLOhSxDnIvkFqsv NDCA== Received: by 10.68.231.39 with SMTP id td7mr28736950pbc.3.1344354723014; Tue, 07 Aug 2012 08:52:03 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id op10sm7982776pbc.75.2012.08.07.08.51.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Aug 2012 08:52:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2012 17:51:42 +0200 Message-Id: <1344354707-27315-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1344354707-27315-1-git-send-email-pbonzini@redhat.com> References: <1344354707-27315-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: owasserm@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 1/6] migration: clean up server sockets and handlers before invoking process_incoming_migration 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 We will not accept any other migration from the server socket, so we can close it. Signed-off-by: Paolo Bonzini --- migration-exec.c | 2 +- migration-fd.c | 2 +- migration-tcp.c | 7 +++---- migration-unix.c | 7 +++---- 4 file modificati, 8 inserzioni(+), 10 rimozioni(-) diff --git a/migration-exec.c b/migration-exec.c index 6c97db9..061131a 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -97,8 +97,8 @@ static void exec_accept_incoming_migration(void *opaque) { QEMUFile *f = opaque; - process_incoming_migration(f); qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); + process_incoming_migration(f); qemu_fclose(f); } diff --git a/migration-fd.c b/migration-fd.c index 50138ed..87705c0 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -103,8 +103,8 @@ static void fd_accept_incoming_migration(void *opaque) { QEMUFile *f = opaque; - process_incoming_migration(f); qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); + process_incoming_migration(f); qemu_fclose(f); } diff --git a/migration-tcp.c b/migration-tcp.c index 440804d..587413e 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -119,12 +119,14 @@ static void tcp_accept_incoming_migration(void *opaque) do { c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); + qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); + close(s); DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); - goto out2; + goto out; } f = qemu_fopen_socket(c); @@ -137,9 +139,6 @@ static void tcp_accept_incoming_migration(void *opaque) qemu_fclose(f); out: close(c); -out2: - qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); - close(s); } int tcp_start_incoming_migration(const char *host_port, Error **errp) diff --git a/migration-unix.c b/migration-unix.c index 169de88..a407af2 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -129,12 +129,14 @@ static void unix_accept_incoming_migration(void *opaque) do { c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && errno == EINTR); + qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); + close(s); DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); - goto out2; + goto out; } f = qemu_fopen_socket(c); @@ -147,9 +149,6 @@ static void unix_accept_incoming_migration(void *opaque) qemu_fclose(f); out: close(c); -out2: - qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); - close(s); } int unix_start_incoming_migration(const char *path)