public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tcp hang solved
@ 2002-11-04  0:27 Andries.Brouwer
  2002-11-04 10:36 ` David S. Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Andries.Brouwer @ 2002-11-04  0:27 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, linux-net, torvalds

Recent 2.5 kernels were unusable since rlogin sessions would
inexplicably hang for many seconds. tcpdump reveals that
the remote host sends packets A,B,C, the local host acks A,
remote host sends D, local host acks A, sacks C, D, and,
for example 47 seconds later, the remote host retransmits B.

Until 2.5.34 the scenario would be the same, but the retransmission
would occur after less than a second.

If I am not mistaken, the cause of this change in behaviour is
the removal of tcp_store_ts_recent() one place, and addition
three other places. At first sight the three new places seem to
cover the old call, but inspection shows that the conditions
changed. So, the following patch should be appropriate.

Andries


--- linux-2.5.45/linux/net/ipv4/tcp_input.c	Thu Oct 31 14:14:51 2002
+++ linux-2.5.45a/linux/net/ipv4/tcp_input.c	Mon Nov  4 01:10:27 2002
@@ -3433,6 +3433,7 @@
 				    (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) &&
 				    tp->rcv_nxt == tp->rcv_wup)
 					tcp_store_ts_recent(tp);
+
 				/* We know that such packets are checksummed
 				 * on entry.
 				 */
@@ -3454,10 +3455,6 @@
 				__set_current_state(TASK_RUNNING);
 
 				if (!tcp_copy_to_iovec(sk, skb, tcp_header_len)) {
-					__skb_pull(skb, tcp_header_len);
-					tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
-					NET_INC_STATS_BH(TCPHPHitsToUser);
-					eaten = 1;
 					/* Predicted packet is in window by definition.
 					 * seq == rcv_nxt and rcv_wup <= rcv_nxt.
 					 * Hence, check seq<=rcv_wup reduces to:
@@ -3467,6 +3464,11 @@
 					     TCPOLEN_TSTAMP_ALIGNED) &&
 					    tp->rcv_nxt == tp->rcv_wup)
 						tcp_store_ts_recent(tp);
+
+					__skb_pull(skb, tcp_header_len);
+					tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
+					NET_INC_STATS_BH(TCPHPHitsToUser);
+					eaten = 1;
 				}
 			}
 			if (!eaten) {

[now that this code+comment occurs three times, an inline function
is perhaps nicer]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-11-04 16:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-04  0:27 [PATCH] tcp hang solved Andries.Brouwer
2002-11-04 10:36 ` David S. Miller
2002-11-04 11:38   ` Sebastian Benoit
2002-11-04 13:59     ` David S. Miller
2002-11-04 13:18       ` Sebastian Benoit
2002-11-04 14:39         ` David S. Miller
2002-11-04 16:10           ` Sebastian Benoit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox