From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH for-4.5] tools/oxenstored: Fix | vs & error in fd event handling Date: Wed, 26 Nov 2014 13:41:30 -0500 Message-ID: <20141126184130.GB13384@laptop.dumpdata.com> References: <1417014580-27611-1-git-send-email-andrew.cooper3@citrix.com> <5475F3DF.2070907@zheng.li> <0CD34053-C7C1-423B-9D00-E455B7099968@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <0CD34053-C7C1-423B-9D00-E455B7099968@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dave Scott Cc: Zheng Li , Wei Liu , Ian Campbell , Andrew Cooper , Xen-devel , "Zheng Li (3P)" , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Wed, Nov 26, 2014 at 06:24:11PM +0000, Dave Scott wrote: > > > On 26 Nov 2014, at 15:38, Zheng Li wrote: > > > > 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 > > This also looks fine to me > > Acked-by: David Scott Would it be possible to get an Reviewed-by please? Thank you. > > Cheers, > Dave > > > > > > > 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); > >> > >> } > >> >