From: Jeffrey Altman Date: Tue, 20 Oct 2009 20:16:47 +0000 (-0400) Subject: prevent rx peer timeout from reaching 0.0 seconds X-Git-Tag: openafs-stable-1_4_12pre1~26 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f97d860db9f98605e5db9ad5a3c44cc6868b8590;p=packages%2Fo%2Fopenafs.git prevent rx peer timeout from reaching 0.0 seconds The rx peer timeout is computed from the round trip time calculation. It traditionally has had a lowerbound of 350ms. The computation in rxi_ComputeRoundTripTime() was incorrect and instead used 350ms as an upperbound. rxi_ComputeRoundTripTime() had a second problem wherein if the actually RTT is shorter than the resolution of the clock then the RTT would quickly approach 0.0 seconds. Enforce a lowerbound of 1ms if the RTT for a given packet appears to be 0.0 seconds. LICENSE BSD Change-Id: I83d3a3d64127d4c023df2fce5e45a4df3eb35679 Reviewed-on: http://gerrit.openafs.org/696 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear Reviewed-on: http://gerrit.openafs.org/974 --- diff --git a/src/rx/rx.c b/src/rx/rx.c index 812eeab1a..0fdb8ab5a 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -5708,6 +5708,15 @@ rxi_ComputeRoundTripTime(register struct rx_packet *p, return; /* somebody set the clock back, don't count this time. */ } clock_Sub(rttp, sentp); + if (rttp->sec == 0 && rttp->usec == 0) { + /* + * The actual round trip time is shorter than the + * clock_GetTime resolution. It is most likely 1ms or 100ns. + * Since we can't tell which at the moment we will assume 1ms. + */ + rttp->usec = 1000; + } + MUTEX_ENTER(&rx_stats_mutex); if (clock_Lt(rttp, &rx_stats.minRtt)) rx_stats.minRtt = *rttp; @@ -5781,7 +5790,7 @@ rxi_ComputeRoundTripTime(register struct rx_packet *p, * be switched and/or swapped out. So on fast, reliable networks, the * timeout would otherwise be too short. */ - rtt_timeout = MIN((peer->rtt >> 3) + peer->rtt_dev, 350); + rtt_timeout = MAX(((peer->rtt >> 3) + peer->rtt_dev), 350); clock_Zero(&(peer->timeout)); clock_Addmsec(&(peer->timeout), rtt_timeout);