svn commit: r284245 - head/sys/netinet

Julien Charbon jch at freebsd.org
Thu Jun 11 13:23:50 UTC 2015


 Hi John,

On 10/06/15 17:32, John Baldwin wrote:
> On 6/10/15 4:43 PM, Julien Charbon wrote:
>> Author: jch
>> Date: Wed Jun 10 20:43:07 2015
>> New Revision: 284245
>> URL: https://svnweb.freebsd.org/changeset/base/284245
>>
>> Log:
>>   Fix a callout race condition introduced in TCP timers callouts with r281599.
>>   In TCP timer context, it is not enough to check callout_stop() return value
>>   to decide if a callout is still running or not, previous callout_reset()
>>   return values have also to be checked.
>>   
>>   Differential Revision:	https://reviews.freebsd.org/D2763
>>   Reviewed by:		hiren
>>   Approved by:		hiren
>>   MFC after:		1 day
>>   Sponsored by:		Verisign, Inc.
>>
>> Modified:
>>   head/sys/netinet/tcp_timer.c
>>   head/sys/netinet/tcp_timer.h
>>
>> Modified: head/sys/netinet/tcp_timer.c
>> ==============================================================================
>> --- head/sys/netinet/tcp_timer.c	Wed Jun 10 20:11:28 2015	(r284244)
>> +++ head/sys/netinet/tcp_timer.c	Wed Jun 10 20:43:07 2015	(r284245)
>> @@ -347,11 +347,12 @@ tcp_timer_2msl(void *xtp)
>>  		tp = tcp_close(tp);             
>>  	} else {
>>  		if (tp->t_state != TCPS_TIME_WAIT &&
>> -		   ticks - tp->t_rcvtime <= TP_MAXIDLE(tp))
>> -		       callout_reset_on(&tp->t_timers->tt_2msl,
>> -			   TP_KEEPINTVL(tp), tcp_timer_2msl, tp,
>> -			   inp_to_cpuid(inp));
>> -	       else
>> +		   ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) {
>> +			if (!callout_reset(&tp->t_timers->tt_2msl,
>> +			   TP_KEEPINTVL(tp), tcp_timer_2msl, tp)) {
>> +				tp->t_timers->tt_flags &= ~TT_2MSL_RST;
>> +			}
>> +		} else
>>  		       tp = tcp_close(tp);
> 
> Did you mean to use callout_reset() instead of callout_reset_on() here and
> elsewhere in this change?

 Thanks for this question.  Exactly, the goal here is to make clear that
once a TCP timer callout is scheduled on a core, we always reset this
callout on the same core.

 It was already the case before, but having only one callout_reset_on()
call in tcp_timer_activate() when we start callout the first time, and
callout_reset() calls everywhere else make it (hopefully) clearer.

 My 2 cents.

--
Julien

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20150611/54c9f184/attachment.sig>


More information about the svn-src-head mailing list