From patchwork Tue Sep 20 13:24:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 115546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8D66CB6F7B for ; Wed, 21 Sep 2011 00:10:51 +1000 (EST) Received: from localhost ([::1]:38591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R60KX-0002U1-Oh for incoming@patchwork.ozlabs.org; Tue, 20 Sep 2011 09:25:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R60Jz-00012s-Ff for qemu-devel@nongnu.org; Tue, 20 Sep 2011 09:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R60Jy-0005Bs-8f for qemu-devel@nongnu.org; Tue, 20 Sep 2011 09:25:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R60Jy-0005Bc-1a for qemu-devel@nongnu.org; Tue, 20 Sep 2011 09:25:10 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KDP0JB007639 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Sep 2011 09:25:00 -0400 Received: from trasno.mitica (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8KDOpQl017005; Tue, 20 Sep 2011 09:24:58 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 20 Sep 2011 15:24:44 +0200 Message-Id: <26dc4cc40ec26fe309147639a46334ca393cb1b8.1316524908.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Yoshiaki Tamura Subject: [Qemu-devel] [PATCH 5/7] migration: add error handling to migrate_fd_put_notify(). 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 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 | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration.c b/migration.c index c56d29c..7f8928a 100644 --- a/migration.c +++ b/migration.c @@ -312,6 +312,9 @@ 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); + } } ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) @@ -328,9 +331,6 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) if (ret == -EAGAIN) { qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s); - } else if (ret < 0) { - s->state = MIG_STATE_ERROR; - notifier_list_notify(&migration_state_notifiers, NULL); } return ret;