## Automatically generated incremental diff
## From:   linux-2.2.7-pre2
## To:     linux-2.2.7-pre3
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.2.7-pre2/include/net/tcp.h linux-2.2.7-pre3/include/net/tcp.h
--- linux-2.2.7-pre2/include/net/tcp.h	1999-04-16 14:29:13.000000000 -0700
+++ linux-2.2.7-pre3/include/net/tcp.h	2003-08-15 15:05:48.000000000 -0700
@@ -793,17 +793,22 @@
 	 *	c) We are retransmiting [Nagle]
 	 *	d) We have too many packets 'in flight'
 	 *
-	 * 	Don't use the nagle rule for urgent data.
+	 * 	Don't use the nagle rule for urgent data (or
+	 *	for the final FIN -DaveM).
 	 */
 	if ((sk->nonagle == 2 && (skb->len < tp->mss_cache)) ||
 	    (!sk->nonagle &&
 	     skb->len < (tp->mss_cache >> 1) &&
 	     tp->packets_out &&
-	     !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_URG)))
+	     !(TCP_SKB_CB(skb)->flags & (TCPCB_FLAG_URG|TCPCB_FLAG_FIN))))
 		nagle_check = 0;
 
+	/* Don't be strict about the congestion window for the
+	 * final FIN frame.  -DaveM
+	 */
 	return (nagle_check &&
-		(tcp_packets_in_flight(tp) < tp->snd_cwnd) &&
+		((tcp_packets_in_flight(tp) < tp->snd_cwnd) ||
+		 (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) &&
 		!after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) &&
 		tp->retransmits == 0);
 }
diff -urN linux-2.2.7-pre2/mm/vmscan.c linux-2.2.7-pre3/mm/vmscan.c
--- linux-2.2.7-pre2/mm/vmscan.c	1999-02-05 09:29:36.000000000 -0800
+++ linux-2.2.7-pre3/mm/vmscan.c	2003-08-15 15:05:48.000000000 -0700
@@ -45,12 +45,7 @@
 	page = pte_page(pte);
 	if (MAP_NR(page) >= max_mapnr)
 		return 0;
-
 	page_map = mem_map + MAP_NR(page);
-	if (PageReserved(page_map)
-	    || PageLocked(page_map)
-	    || ((gfp_mask & __GFP_DMA) && !PageDMA(page_map)))
-		return 0;
 
 	if (pte_young(pte)) {
 		/*
@@ -62,6 +57,11 @@
 		return 0;
 	}
 
+	if (PageReserved(page_map)
+	    || PageLocked(page_map)
+	    || ((gfp_mask & __GFP_DMA) && !PageDMA(page_map)))
+		return 0;
+
 	/*
 	 * Is the page already in the swap cache? If so, then
 	 * we can just drop our reference to it without doing
@@ -248,9 +248,8 @@
 	pgd_t *pgdir;
 	unsigned long end;
 
-	/* Don't swap out areas like shared memory which have their
-	    own separate swapping mechanism or areas which are locked down */
-	if (vma->vm_flags & (VM_SHM | VM_LOCKED))
+	/* Don't swap out areas which are locked down */
+	if (vma->vm_flags & VM_LOCKED)
 		return 0;
 
 	pgdir = pgd_offset(tsk->mm, address);
diff -urN linux-2.2.7-pre2/net/ipv4/tcp_input.c linux-2.2.7-pre3/net/ipv4/tcp_input.c
--- linux-2.2.7-pre2/net/ipv4/tcp_input.c	2003-08-15 15:05:48.000000000 -0700
+++ linux-2.2.7-pre3/net/ipv4/tcp_input.c	2003-08-15 15:05:48.000000000 -0700
@@ -5,7 +5,7 @@
  *
  *		Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:	$Id: tcp_input.c,v 1.161 1999/04/01 04:35:26 davem Exp $
+ * Version:	$Id: tcp_input.c,v 1.162 1999/04/24 00:27:16 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -2189,8 +2189,22 @@
 		}
 	}
 
+	/* The silly FIN test here is necessary to see an advancing ACK in
+	 * retransmitted FIN frames properly.  Consider the following sequence:
+	 *
+	 *	host1 --> host2		FIN XSEQ:XSEQ(0) ack YSEQ
+	 *	host2 --> host1		FIN YSEQ:YSEQ(0) ack XSEQ
+	 *	host1 --> host2		XSEQ:XSEQ(0) ack YSEQ+1
+	 *	host2 --> host1		FIN YSEQ:YSEQ(0) ack XSEQ+1	(fails tcp_sequence test)
+	 *
+	 * At this point the connection will deadlock with host1 believing
+	 * that his FIN is never ACK'd, and thus it will retransmit it's FIN
+	 * forever.  The following fix is from Taral (taral@taral.net).
+	 */
+
 	/* step 1: check sequence number */
-	if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq)) {
+	if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq) &&
+	    !(th->fin && TCP_SKB_CB(skb)->end_seq == tp->rcv_nxt)) {
 		if (!th->rst) {
 			tcp_send_ack(sk);
 			goto discard;
diff -urN linux-2.2.7-pre2/net/ipv4/tcp_ipv4.c linux-2.2.7-pre3/net/ipv4/tcp_ipv4.c
--- linux-2.2.7-pre2/net/ipv4/tcp_ipv4.c	2003-08-15 15:05:48.000000000 -0700
+++ linux-2.2.7-pre3/net/ipv4/tcp_ipv4.c	2003-08-15 15:05:48.000000000 -0700
@@ -5,7 +5,7 @@
  *
  *		Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:	$Id: tcp_ipv4.c,v 1.172 1999/04/22 10:07:36 davem Exp $
+ * Version:	$Id: tcp_ipv4.c,v 1.173 1999/04/24 00:27:07 davem Exp $
  *
  *		IPv4 specific functions
  *
@@ -1358,7 +1358,14 @@
 		newtp->last_ack_sent = req->rcv_isn + 1;
 		newtp->backoff = 0;
 		newtp->mdev = TCP_TIMEOUT_INIT;
-		newtp->snd_cwnd = 1;
+
+		/* So many TCP implementations out there (incorrectly) count the
+		 * initial SYN frame in their delayed-ACK and congestion control
+		 * algorithms that we must have the following bandaid to talk
+		 * efficiently to them.  -DaveM
+		 */
+		newtp->snd_cwnd = 2;
+
 		newtp->rto = TCP_TIMEOUT_INIT;
 		newtp->packets_out = 0;
 		newtp->fackets_out = 0;
@@ -1839,10 +1846,16 @@
 	tp->mdev = TCP_TIMEOUT_INIT;
 	tp->mss_clamp = ~0;
       
+	/* So many TCP implementations out there (incorrectly) count the
+	 * initial SYN frame in their delayed-ACK and congestion control
+	 * algorithms that we must have the following bandaid to talk
+	 * efficiently to them.  -DaveM
+	 */
+	tp->snd_cwnd = 2;
+
 	/* See draft-stevens-tcpca-spec-01 for discussion of the
 	 * initialization of these values.
 	 */
-	tp->snd_cwnd = 1;
 	tp->snd_cwnd_cnt = 0;
 	tp->snd_ssthresh = 0x7fffffff;	/* Infinity */
 
diff -urN linux-2.2.7-pre2/net/ipv6/ip6_flowlabel.c linux-2.2.7-pre3/net/ipv6/ip6_flowlabel.c
--- linux-2.2.7-pre2/net/ipv6/ip6_flowlabel.c	2003-08-15 15:05:48.000000000 -0700
+++ linux-2.2.7-pre3/net/ipv6/ip6_flowlabel.c	2003-08-15 15:05:48.000000000 -0700
@@ -9,6 +9,7 @@
  *	Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
  */
 
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
diff -urN linux-2.2.7-pre2/net/ipv6/tcp_ipv6.c linux-2.2.7-pre3/net/ipv6/tcp_ipv6.c
--- linux-2.2.7-pre2/net/ipv6/tcp_ipv6.c	2003-08-15 15:05:48.000000000 -0700
+++ linux-2.2.7-pre3/net/ipv6/tcp_ipv6.c	2003-08-15 15:05:48.000000000 -0700
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: tcp_ipv6.c,v 1.103 1999/04/22 10:07:46 davem Exp $
+ *	$Id: tcp_ipv6.c,v 1.104 1999/04/24 00:27:25 davem Exp $
  *
  *	Based on: 
  *	linux/net/ipv4/tcp.c
@@ -1575,10 +1575,16 @@
 	tp->mdev = TCP_TIMEOUT_INIT;
 	tp->mss_clamp = ~0;
 
+	/* So many TCP implementations out there (incorrectly) count the
+	 * initial SYN frame in their delayed-ACK and congestion control
+	 * algorithms that we must have the following bandaid to talk
+	 * efficiently to them.  -DaveM
+	 */
+	tp->snd_cwnd = 2;
+
 	/* See draft-stevens-tcpca-spec-01 for discussion of the
 	 * initialization of these values.
 	 */
-	tp->snd_cwnd = 1;
 	tp->snd_cwnd_cnt = 0;
 	tp->snd_ssthresh = 0x7fffffff;
 
