[PATCH] Fix ETIME handling for Solaris event ports

Ralph Boehme rb at sernet.de
Thu Feb 4 22:44:42 UTC 2016


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