From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpNj1-0005kY-VG for qemu-devel@nongnu.org; Fri, 05 Aug 2011 12:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpNj0-0004Es-Up for qemu-devel@nongnu.org; Fri, 05 Aug 2011 12:58:19 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:61609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpNj0-0004Em-Nq for qemu-devel@nongnu.org; Fri, 05 Aug 2011 12:58:18 -0400 Received: by gxk26 with SMTP id 26so270507gxk.4 for ; Fri, 05 Aug 2011 09:58:18 -0700 (PDT) Message-ID: <4E3C2126.207@redhat.com> Date: Fri, 05 Aug 2011 11:58:14 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <4E3B979E.8030402@web.de> In-Reply-To: <4E3B979E.8030402@web.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Marcelo Tosatti , Michael Tokarev , qemu-devel , Luiz Capitulino On 08/05/2011 02:11 AM, Jan Kiszka wrote: > From: Jan Kiszka > > If migration failed in migrate_fd_put_buffer, the monitor may have been > resumed not only in the error path of that function but also once again > in migrate_fd_put_ready which is called unconditionally by > migrate_fd_connect. > > Fix this by establishing a cleaner policy: the monitor shall be resumed > when the migration file is closed, either via callback > (migrate_fd_close) or in migrate_fd_cleanup if no file is open (i.e. no > callback invoked). > > Signed-off-by: Jan Kiszka Applied. Thanks. Regards, Anthony Liguori > --- > migration.c | 19 +++++++++---------- > 1 files changed, 9 insertions(+), 10 deletions(-) > > diff --git a/migration.c b/migration.c > index 2a15b98..756fa62 100644 > --- a/migration.c > +++ b/migration.c > @@ -292,18 +292,17 @@ int migrate_fd_cleanup(FdMigrationState *s) > ret = -1; > } > s->file = NULL; > + } else { > + if (s->mon) { > + monitor_resume(s->mon); > + } > } > > - if (s->fd != -1) > + if (s->fd != -1) { > close(s->fd); > - > - /* Don't resume monitor until we've flushed all of the buffers */ > - if (s->mon) { > - monitor_resume(s->mon); > + s->fd = -1; > } > > - s->fd = -1; > - > return ret; > } > > @@ -330,9 +329,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) { > - if (s->mon) { > - monitor_resume(s->mon); > - } > s->state = MIG_STATE_ERROR; > notifier_list_notify(&migration_state_notifiers, NULL); > } > @@ -458,6 +454,9 @@ int migrate_fd_close(void *opaque) > { > FdMigrationState *s = opaque; > > + if (s->mon) { > + monitor_resume(s->mon); > + } > qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); > return s->close(s); > }