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-devel-1_5_66~32 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=cc112e7a59d441d28a1d195cb48f23887df51929;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 Reviewed-on: http://gerrit.openafs.org/696 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- diff --git a/src/rx/rx.c b/src/rx/rx.c index 36ee1e39c..c7d4ad7af 100755 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -5988,6 +5988,16 @@ rxi_ComputeRoundTripTime(struct rx_packet *p, clock_Sub(rttp, sentp); dpf(("rxi_ComputeRoundTripTime(call=%d packet=%"AFS_PTR_FMT" rttp=%d.%06d sec)\n", p->header.callNumber, p, rttp->sec, rttp->usec)); + + 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; + } + if (rx_stats_active) { MUTEX_ENTER(&rx_stats_mutex); if (clock_Lt(rttp, &rx_stats.minRtt)) @@ -6063,7 +6073,7 @@ rxi_ComputeRoundTripTime(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);