From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R764O-0005Yi-KF for qemu-devel@nongnu.org; Fri, 23 Sep 2011 09:45:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R764J-0007df-5F for qemu-devel@nongnu.org; Fri, 23 Sep 2011 09:45:36 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:53501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R764J-0007dX-0r for qemu-devel@nongnu.org; Fri, 23 Sep 2011 09:45:31 -0400 Received: by wwg14 with SMTP id 14so3177372wwg.10 for ; Fri, 23 Sep 2011 06:45:30 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E7C8D77.8070301@redhat.com> Date: Fri, 23 Sep 2011 15:45:27 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/11] migration: add error handling to migrate_fd_put_notify(). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org, Yoshiaki Tamura On 09/23/2011 02:50 PM, Juan Quintela wrote: > 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; Why not leave both (or even better, call migrate_fd_error in the else branch)? Paolo