From: Ian Campbell <ian.campbell@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 6/6] tools/libxl: Adjust datacopiers POLLHUP handling when the fd is also readable
Date: Wed, 11 Mar 2015 12:21:36 +0000 [thread overview]
Message-ID: <1426076496.21353.221.camel@citrix.com> (raw)
In-Reply-To: <1425668741-28003-7-git-send-email-andrew.cooper3@citrix.com>
On Fri, 2015-03-06 at 19:05 +0000, Andrew Cooper wrote:
> POLLHUP|POLLIN is a valid revent to receive when there is readable data in a
> pipe, but the writable fd has been closed. This occurs in migration v2 when
> the legacy conversion process (which transforms the data inline) completes and
> exits successfully.
>
> In the case that there is data to read, suppress the POLLHUP. POSIX states
> that the hangup state is latched[1], which means it will reoccur on subsequent
> poll() calls. The datacopier is thus provided the opportunity to read until
> EOF, if possible.
>
> A POLLHUP on its own is treated exactly as before, indicating a different
> error with the fd.
>
> [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
Having looked at the previous thread I'm satisfied that this matches
what was discussed there, but I think the final ack needs to come from
Ian.
>
> ---
> v2: Rework solution from scratch
> ---
> tools/libxl/libxl_aoutils.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c
> index a402e5c..a5ad3e5 100644
> --- a/tools/libxl/libxl_aoutils.c
> +++ b/tools/libxl/libxl_aoutils.c
> @@ -204,6 +204,9 @@ static void datacopier_readable(libxl__egc *egc, libxl__ev_fd *ev,
> libxl__datacopier_state *dc = CONTAINER_OF(ev, *dc, toread);
> STATE_AO_GC(dc->ao);
>
> + if ((revents & (POLLHUP|POLLIN)) == (POLLHUP|POLLIN))
> + revents &= ~POLLHUP;
> +
> if (datacopier_pollhup_handled(egc, dc, revents, 0))
> return;
>
prev parent reply other threads:[~2015-03-11 12:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 19:05 [PATCH v2 0/6] tools/libxl: Improvements to libxl__datacopier Andrew Cooper
2015-03-06 19:05 ` [PATCH v2 1/6] tools/libxl: Introduce min and max macros Andrew Cooper
2015-03-11 12:07 ` Ian Campbell
2015-03-06 19:05 ` [PATCH v2 2/6] tools/libxl: Update datacopier to support sending data only Andrew Cooper
2015-03-11 12:07 ` Ian Campbell
2015-03-06 19:05 ` [PATCH v2 3/6] tools/libxl: Avoid overrunning static buffer with prefixdata Andrew Cooper
2015-03-11 12:09 ` Ian Campbell
2015-03-06 19:05 ` [PATCH v2 4/6] tools/libxl: Allow limiting amount copied by datacopier Andrew Cooper
2015-03-11 12:15 ` Ian Campbell
2015-03-11 12:23 ` Andrew Cooper
2015-03-11 12:31 ` Ian Campbell
2015-03-06 19:05 ` [PATCH v2 5/6] tools/libxl: Extend datacopier to support reading into a buffer Andrew Cooper
2015-03-11 12:19 ` Ian Campbell
2015-03-16 13:31 ` Ross Lagerwall
2015-03-06 19:05 ` [PATCH v2 6/6] tools/libxl: Adjust datacopiers POLLHUP handling when the fd is also readable Andrew Cooper
2015-03-11 12:21 ` Ian Campbell [this message]
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=1426076496.21353.221.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/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.