From patchwork Wed Feb 23 21:47:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 84275 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 E738FB715B for ; Thu, 24 Feb 2011 10:45:49 +1100 (EST) Received: from localhost ([127.0.0.1]:41319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsNMy-0001CA-Fj for incoming@patchwork.ozlabs.org; Wed, 23 Feb 2011 17:39:40 -0500 Received: from [140.186.70.92] (port=35714 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsMZI-0000V7-BU for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsMZE-0005G5-Tw for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsMZE-0005Fr-Fu for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:16 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLmEBH028057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 23 Feb 2011 16:48:14 -0500 Received: from trasno.mitica (ovpn-113-97.phx2.redhat.com [10.3.113.97]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLlhCF020923; Wed, 23 Feb 2011 16:48:13 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Feb 2011 22:47:32 +0100 Message-Id: <1441db4c684621ce46ea35790e9da2799a2c0341.1298492768.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Yoshiaki Tamura Subject: [Qemu-devel] [PATCH 23/28] migration: add error handling to migrate_fd_put_notify(). 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 From: Yoshiaki Tamura Although migrate_fd_put_buffer() sets MIG_STATE_ERROR if it failed, since migrate_fd_put_notify() isn't checking error of underlying QEMUFile, those resources are kept open. This patch checks it and calls migrate_fd_error() in case of error. Signed-off-by: Yoshiaki Tamura Signed-off-by: Juan Quintela --- migration.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/migration.c b/migration.c index 697c74f..a02100b 100644 --- a/migration.c +++ b/migration.c @@ -241,6 +241,9 @@ static void migrate_fd_put_notify(void *opaque) qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); qemu_file_put_notify(s->file); + if (qemu_file_has_error(s->file)) { + migrate_fd_error(s); + } } static ssize_t migrate_fd_put_buffer(void *opaque, const void *data, @@ -258,12 +261,6 @@ static ssize_t migrate_fd_put_buffer(void *opaque, const void *data, if (ret == -EAGAIN) { qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s); - } else if (ret < 0) { - if (s->mon) { - monitor_resume(s->mon); - } - s->state = MIG_STATE_ERROR; - notifier_list_notify(&migration_state_notifiers); } return ret;