From patchwork Fri Sep 23 12:50:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 116063 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 E42AFB6F80 for ; Fri, 23 Sep 2011 22:52:36 +1000 (EST) Received: from localhost ([::1]:48999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75Et-0007GK-JQ for incoming@patchwork.ozlabs.org; Fri, 23 Sep 2011 08:52:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75ED-0005sc-4l for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:51:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R75E6-0003My-JQ for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:51:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75E6-0003Mr-AN for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:51:34 -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 p8NCpL9k031523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2011 08:51:21 -0400 Received: from neno.neno (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8NCpBph018512; Fri, 23 Sep 2011 08:51:20 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 23 Sep 2011 14:50:41 +0200 Message-Id: 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 05/11] 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 9498e20..0b284ff 100644 --- a/migration.c +++ b/migration.c @@ -313,6 +313,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) @@ -329,9 +332,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;