All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Leonardo Bras <leobras@redhat.com>
Cc: Lukas Straub <lukasstraub2@web.de>,
	qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH v1 1/1] migration: Unregister yank if migration setup fails
Date: Thu, 24 Jun 2021 18:20:08 +0100	[thread overview]
Message-ID: <YNS+yAMMpXUE1C/w@work-vm> (raw)
In-Reply-To: <YNS9fwd/dNs5LJ/+@work-vm>

* Dr. David Alan Gilbert (dgilbert@redhat.com) wrote:
> * Leonardo Bras (leobras@redhat.com) wrote:
> > Currently, if a qemu instance is started with "-incoming defer" and
> > an incorect parameter is passed to "migrate_incoming", it will print the
> > expected error and reply with "duplicate yank instance" for any upcoming
> > "migrate_incoming" command.
> > 
> > This renders current qemu process unusable, and requires a new qemu
> > process to be started before accepting a migration.
> > 
> > This is caused by a yank_register_instance() that happens in
> > qemu_start_incoming_migration() but is never reverted if any error
> > happens.
> > 
> > Solves this by unregistering the instance if anything goes wrong
> > in the function, allowing a new "migrate_incoming" command to be
> > accepted.
> > 
> > Fixes: b5eea99ec2f ("migration: Add yank feature", 2021-01-13)
> > Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1974366
> > Signed-off-by: Leonardo Bras <leobras@redhat.com>
> > 
> > ---
> >  migration/migration.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 4228635d18..ddcf9e1868 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -474,9 +474,13 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp)
> >      } else if (strstart(uri, "fd:", &p)) {
> >          fd_start_incoming_migration(p, errp);
> >      } else {
> > -        yank_unregister_instance(MIGRATION_YANK_INSTANCE);
> >          error_setg(errp, "unknown migration protocol: %s", uri);
> >      }
> > +
> > +    if (*errp) {
> > +        yank_unregister_instance(MIGRATION_YANK_INSTANCE);
> > +    }
> 
> My understanding is that testing *errp isn't allowed, because
> it's legal to pass NULL to ignore errors, or legal to pass
> &error_abort to mean that any error you do hit will cause the
> process to assert; so you need to have something separate you can test.

Ah, and armbru points out there's a 'new' mechanism to make it safe;
you need to use ERRP_GUARD, see include/qapi/error.h if you want to
be able to test it.

Dave

> Dave
> 
> >  }
> >  
> >  static void process_incoming_migration_bh(void *opaque)
> > -- 
> > 2.32.0
> > 
> -- 
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2021-06-24 17:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  2:42 [PATCH v1 1/1] migration: Unregister yank if migration setup fails Leonardo Bras
2021-06-22 17:38 ` Peter Xu
2021-06-22 23:31   ` Leonardo Bras Soares Passos
2021-06-24 17:14 ` Dr. David Alan Gilbert
2021-06-24 17:20   ` Dr. David Alan Gilbert [this message]
2021-06-24 17:29   ` Peter Xu

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=YNS+yAMMpXUE1C/w@work-vm \
    --to=dgilbert@redhat.com \
    --cc=leobras@redhat.com \
    --cc=lukasstraub2@web.de \
    --cc=peterx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.