qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/7] migration: only flush when there are no errors
Date: Tue, 20 Sep 2011 17:48:49 +0200	[thread overview]
Message-ID: <4E78B5E1.4080608@redhat.com> (raw)
In-Reply-To: <2fb9e253266c4926a168168c854fdf5c68ccfca3.1316524908.git.quintela@redhat.com>

On 09/20/2011 03:24 PM, Juan Quintela wrote:
> If we have one error while migrating, and then we issuse a
> "migrate_cancel" command, guest hang.  Fix it for flushing only when
> migration is in MIG_STATE_ACTIVE.  In case of error of cancellation,
> don't flush.
>
> We had an infinite loop at buffered_close()
>
>          while (!s->has_error && s->buffer_size) {
>              buffered_flush(s);
>              if (s->freeze_output)
>                  s->wait_for_unfreeze(s);
>          }
>
> There was no errors, there were things to send, and connection was
> broken.  send() returns -EAGAIN, so we freezed output, but we
> unfreeze_output and try again.
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>

I don't like the idea of adding an extra argument to fix a bug 
elsewhere.  I don't consider this even a safety net, since it is relying 
anyway on the migration code setting the new argument correctly:

diff --git a/migration.c b/migration.c
index 9a93e3b..15d001e 100644
--- a/migration.c
+++ b/migration.c
@@ -288,7 +288,7 @@ int migrate_fd_cleanup(FdMigrationState *s)

      if (s->file) {
          DPRINTF("closing file\n");
-        if (qemu_fclose(s->file) != 0) {
+        if (qemu_fclose(s->file, s->state == MIG_STATE_ACTIVE) != 0) {
              ret = -1;
          }
          s->file = NULL;

Dan's patch is the right fix, this one can be dropped altogether.

If anything, you may consider making wait_for_unfreeze return an error 
code, and set has_error when wait_for_unfreeze returns an error. 
Alternatively, merge QEMUFile and BufferedFile's has_error flags, and 
use qemu_file_set_error when migration is canceled.

Paolo

  parent reply	other threads:[~2011-09-20 15:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20 13:24 [Qemu-devel] [PATCH 0/7] Handle errors during migration Juan Quintela
2011-09-20 13:24 ` [Qemu-devel] [PATCH 1/7] migration: simplify state assignmente Juan Quintela
2011-09-20 13:24 ` [Qemu-devel] [PATCH 2/7] migration: only flush when there are no errors Juan Quintela
2011-09-20 14:25   ` Daniel P. Berrange
2011-09-20 14:47     ` Juan Quintela
2011-09-20 15:48   ` Paolo Bonzini [this message]
2011-09-20 13:24 ` [Qemu-devel] [PATCH 3/7] migration: Check that migration is active before cancel it Juan Quintela
2011-09-20 13:24 ` [Qemu-devel] [PATCH 4/7] savevm: avoid qemu_savevm_state_iterate() to return 1 when qemu file has error Juan Quintela
2011-09-20 13:24 ` [Qemu-devel] [PATCH 5/7] migration: add error handling to migrate_fd_put_notify() Juan Quintela
2011-09-20 15:49   ` Paolo Bonzini
2011-09-20 13:24 ` [Qemu-devel] [PATCH 6/7] migration: If there is one error, it makes no sense to continue Juan Quintela
2011-09-20 13:24 ` [Qemu-devel] [PATCH 7/7] migration: qemu_savevm_iterate has three return values Juan Quintela
2011-09-22  9:50   ` Wayne Xia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E78B5E1.4080608@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).