[PATCH] Fix ETIME handling for Solaris event ports

Nathan Huff nhuff at acm.org
Thu Feb 4 23:05:51 UTC 2016


I read that thread and still wasn't 100% sure that you couldn't get an
event with EINTR.  I think the current patch won't break anything, but it
may be overly cautious.  I am willing to go back to the version that only
checks ETIME for events if that seems better to people.

The two events I have definitely seen on running systems are ETIME with
events and EINTR with no events and not updating nget.


On Thu, Feb 4, 2016 at 3:44 PM, Ralph Boehme <rb at sernet.de> wrote:

> On Thu, Feb 04, 2016 at 01:55:56PM -0800, Jeremy Allison wrote:
> > On Thu, Feb 04, 2016 at 10:33:30PM +0100, Ralph Boehme wrote:
> > > On Thu, Feb 04, 2016 at 01:32:51PM -0800, Jeremy Allison wrote:
> > > > On Wed, Feb 03, 2016 at 03:24:48PM -0700, Nathan Huff wrote:
> > > > > Turns out EINTR is even more messed up than ETIME.  It is possible
> to not
> > > > > get an event and not have nget updated either so you have to
> actually check
> > > > > the event structure you get back.  I have attached an updated
> patch to deal
> > > > > with that situation as well.
> > > >
> > > > Reviewed-by: Jeremy Allison <jra at samba.org>
> > > >
> > > > Nice work Nathan, good catch.
> > > >
> > > > Can I get a second Team reviewer ?
> > >
> > > Nack, I'm not convinced this is the correct fix. The EINTR handling
> > > still seems wrong.
> >
> > Well I did look at that very carefully.
> >
> > The statement above is very clear -
> >
> > "It is possible to not get an event and not have nget updated
> > either so you have to actually check the event structure you get back."
> >
> > Given that the patch handles this correctly.
> >
> > It checks for ret == -1, then in the EINTR case
> > it only calls the signal handler if events[0].portev_source == 0
> > (which means no event was received)
>
> according to the Illumos libc sources, port_getn() doesn't update nget
> on return for any other error then ETIME.
>
> This implies EINTR is only returned if there are no fd events,
> otherwise port_getn() would be completely broken for nget > 1. Luckily
> we're using it with n = 1 so I think we can assume if we get EINTR we
> got a signal and not a fd event, so there's no need to set and test
> events[0].portev_source.
>
> <
> http://networking-discuss.opensolaris.narkive.com/AdTgQU1i/port-getn-and-timeouts-is-this-a-bug-or-an-undocumented-feature
> >
>
> If someone else is confident enought that this patch is correct and
> give a rb, then by all means please go ahead and push it.
>
> -Ralph
>
> --
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de,mailto:kontakt@sernet.de
>


More information about the samba-technical mailing list