[PATCH] Fix ETIME handling for Solaris event ports

Jeremy Allison jra at samba.org
Fri Feb 5 22:46:48 UTC 2016


On Fri, Feb 05, 2016 at 02:11:44PM -0700, Nathan Huff wrote:
> Here is a minimized version of the patch.  I also removed the check for
> tvalp on ETIME since I believe ETIME => tvalp.
> 
> 2016-02-05 4:23 GMT-07:00 Ralph Boehme <rb at sernet.de>:

OK, I'm good with this version and it's close
to Metze's minimal diff requirement.

I don't think we need the errno = 0 as nothing
depends on this in this function, and there's
no guarentee on errno coming out of this function
(we might make many other system calls). So -

Reviewed-by: Jeremy Allison <jra at samba.org>

Ralph and Metze, are you OK with this version ?

Jeremy.

> > > can we minimize the diff please?
> >
> > +1
> >
> > -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
> >

> From a157ef78d61355ccc3fadeecc016ee3dae2f7700 Mon Sep 17 00:00:00 2001
> From: Nathan Huff <nhuff at acm.org>
> Date: Fri, 5 Feb 2016 13:35:07 -0700
> Subject: [PATCH] Fix ETIME handling for Solaris event ports.
> 
> It is possible for port_getn to return -1 with errno set to ETIME and
> still return events. If those events aren't processed the association is
> lost by samba since the kernel dissacociated them and samba never
> processed them so never reassociated them with the event port. The
> patch checks the nget return value in the case of ETIME and if it is non
> 0 it doesn't return and goes through the event processing loop.
> 
> Signed-off-by: Nathan Huff <nhuff at acm.org>
> ---
>  lib/tevent/tevent_port.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/tevent/tevent_port.c b/lib/tevent/tevent_port.c
> index 5b487d7..8898b57 100644
> --- a/lib/tevent/tevent_port.c
> +++ b/lib/tevent/tevent_port.c
> @@ -496,10 +496,24 @@ static int port_event_loop(struct port_event_context *port_ev, struct timeval *t
>  		return 0;
>  	}
>  
> -	if (ret == -1 && port_errno == ETIME && tvalp) {
> -		/* we don't care about a possible delay here */
> -		tevent_common_loop_timer_delay(ev);
> -		return 0;
> +	if (ret == -1 && port_errno == ETIME) {
> +		/*
> +		 * If errno is set to ETIME it is possible that we still got an event.
> +		 * In that case we need to go through the processing loop so that we
> +		 * reassociate the received event with the port or the association will
> +		 * be lost so check the value of nget is 0 before returning.
> +		 */
> +		if(nget == 0) {
> +			/* we don't care about a possible delay here */
> +			tevent_common_loop_timer_delay(ev);
> +			return 0;
> +		}
> +		/*
> +		 * Set the return value to 0 since we do not actually have an error and we
> +		 * do have events that need to be processed.  This keeps us from getting
> +		 * caught in the generic error test.
> +		 */
> +		ret = 0;
>  	}
>  
>  	if (ret == -1) {
> -- 
> 2.5.0
> 




More information about the samba-technical mailing list