From: Zheng Li <dev@zheng.li>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Zheng Li <zheng.li3@citrix.com>,
Dave Scott <Dave.Scott@eu.citrix.com>
Subject: Re: [PATCH for-4.5] tools/oxenstored: Fix | vs & error in fd event handling
Date: Wed, 26 Nov 2014 15:38:07 +0000 [thread overview]
Message-ID: <5475F3DF.2070907@zheng.li> (raw)
In-Reply-To: <1417014580-27611-1-git-send-email-andrew.cooper3@citrix.com>
On 26/11/2014 15:09, Andrew Cooper wrote:
> This makes fields 0 and 1 true more often than they should be, resulting
> problems when handling events.
Indeed, looks like a mistake I made when rewriting the logic terms lately. The result is POLLUP or POLLERR events being returned in more categories than we'd interest. Thanks for fixing this!
Acked-by: Zheng Li <dev@zheng.li>
Cheers,
Zheng
> ---
>
> This was discovered with XenServers internal Coverity instance. I have yet to
> work out why the issue is not identified by the upstream coverity scanning.
>
> Konrad: This is a bug in the default event handling used by oxenstored in 4.5,
> as the default switched from select() to poll() in the 4.5 timeframe. It
> would appear that the negative side effects are limited to just logspam about
> certain clients attempting invalid actions, but I can't rule out anything more
> problematic.
> ---
> tools/ocaml/xenstored/select_stubs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/ocaml/xenstored/select_stubs.c b/tools/ocaml/xenstored/select_stubs.c
> index 4a8edb5..af72b84 100644
> --- a/tools/ocaml/xenstored/select_stubs.c
> +++ b/tools/ocaml/xenstored/select_stubs.c
> @@ -56,8 +56,8 @@ CAMLprim value stub_select_on_poll(value fd_events, value timeo) {
> events = Field(Field(fd_events, i), 1);
>
> if (c_fds[i].revents & POLLNVAL) unix_error(EBADF, "select", Nothing);
> - Field(events, 0) = Val_bool(c_fds[i].events | POLLIN && c_fds[i].revents & (POLLIN |POLLHUP|POLLERR));
> - Field(events, 1) = Val_bool(c_fds[i].events | POLLOUT && c_fds[i].revents & (POLLOUT|POLLHUP|POLLERR));
> + Field(events, 0) = Val_bool(c_fds[i].events & POLLIN && c_fds[i].revents & (POLLIN |POLLHUP|POLLERR));
> + Field(events, 1) = Val_bool(c_fds[i].events & POLLOUT && c_fds[i].revents & (POLLOUT|POLLHUP|POLLERR));
> Field(events, 2) = Val_bool(c_fds[i].revents & POLLPRI);
>
> }
>
next prev parent reply other threads:[~2014-11-26 15:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 15:09 [PATCH for-4.5] tools/oxenstored: Fix | vs & error in fd event handling Andrew Cooper
2014-11-26 15:38 ` Zheng Li [this message]
2014-11-26 18:24 ` Dave Scott
2014-11-26 18:41 ` Konrad Rzeszutek Wilk
2014-11-26 19:03 ` Andrew Cooper
2014-11-26 20:08 ` Zheng Li
2014-11-27 8:55 ` Ian Campbell
2014-11-26 20:44 ` Dave Scott
2014-11-26 21:09 ` Konrad Rzeszutek Wilk
2014-11-28 12:11 ` Ian Campbell
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=5475F3DF.2070907@zheng.li \
--to=dev@zheng.li \
--cc=Dave.Scott@eu.citrix.com \
--cc=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 \
--cc=zheng.li3@citrix.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.