qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Wang Xin <wangxinxin.wang@huawei.com>, berrange@redhat.com
Cc: qemu-devel@nongnu.org, quintela@redhat.com,
	arei.gonglei@huawei.com, peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH] migration/fd: abort migration if receive POLLHUP event
Date: Tue, 24 Apr 2018 18:16:31 +0100	[thread overview]
Message-ID: <20180424171631.GF2521@work-vm> (raw)
In-Reply-To: <1524295325-18136-1-git-send-email-wangxinxin.wang@huawei.com>

* Wang Xin (wangxinxin.wang@huawei.com) wrote:
> If the fd socket peer closed shortly, ppoll may receive a POLLHUP
> event before the expected POLLIN event, and qemu will do nothing
> but goes into an infinite loop of the POLLHUP event.
> 
> So, abort the migration if we receive a POLLHUP event.

Hi Wang Xin,
  Can you explain how you manage to trigger this case; I've not hit it.

> Signed-off-by: Wang Xin <wangxinxin.wang@huawei.com>
> 
> diff --git a/migration/fd.c b/migration/fd.c
> index cd06182..5932c87 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -15,6 +15,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "channel.h"
>  #include "fd.h"
>  #include "monitor/monitor.h"
> @@ -46,6 +47,11 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
>                                               GIOCondition condition,
>                                               gpointer opaque)
>  {
> +    if (condition & G_IO_HUP) {
> +        error_report("The migration peer closed, job abort");
> +        exit(EXIT_FAILURE);
> +    }
> +

OK,  I wish we had a nicer way for failing;  especially for the
multifd/postcopy recovery worlds where one failed connection might not
be fatal; but I don't see how to do that here.

>      migration_channel_process_incoming(ioc);
>      object_unref(OBJECT(ioc));
>      return G_SOURCE_REMOVE;
> @@ -67,7 +73,7 @@ void fd_start_incoming_migration(const char *infd, Error **errp)
>  
>      qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-incoming");
>      qio_channel_add_watch(ioc,
> -                          G_IO_IN,
> +                          G_IO_IN | G_IO_HUP,
>                            fd_accept_incoming_migration,
>                            NULL,
>                            NULL);

Dave

> -- 
> 2.8.1.windows.1
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-04-24 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-21  7:22 [Qemu-devel] [PATCH] migration/fd: abort migration if receive POLLHUP event Wang Xin
2018-04-24 17:16 ` Dr. David Alan Gilbert [this message]
2018-04-24 18:24   ` Daniel P. Berrangé
2018-04-25  3:14     ` Peter Xu
2018-04-25  3:31       ` Peter Xu
2018-04-25  7:29         ` wangxin (U)
2018-04-25  8:03           ` Daniel P. Berrangé

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=20180424171631.GF2521@work-vm \
    --to=dgilbert@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=berrange@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wangxinxin.wang@huawei.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).