PERFORCE change 122694 for review

Marko Zec zec at FreeBSD.org
Mon Jul 2 01:32:57 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=122694

Change 122694 by zec at zec_tpx32 on 2007/07/02 01:31:58

	Unbreak 2MSL timeout processing in TCP when multiple vnets exist.
	NB it is not completely clear to me yet whether we need per-vnet
	twq_2msl queues or is a single global queue enough...  So for
	the moment we'll go on with per-vnet twq_2msl queues.

Affected files ...

.. //depot/projects/vimage/src/sys/netinet/tcp_timewait.c#3 edit

Differences ...

==== //depot/projects/vimage/src/sys/netinet/tcp_timewait.c#3 (text+ko) ====

@@ -102,7 +102,9 @@
  * queue pointers in each tcptw structure, are protected using the global
  * tcbinfo lock, which must be held over queue iteration and modification.
  */
+#ifndef VIMAGE
 static TAILQ_HEAD(, tcptw)	twq_2msl;
+#endif
 
 static void	tcp_tw_2msl_reset(struct tcptw *, int);
 static void	tcp_tw_2msl_stop(struct tcptw *);
@@ -163,6 +165,14 @@
 void
 tcp_tw_init(void)
 {
+	INIT_VNET_INET(curvnet);
+
+	TAILQ_INIT(&V_twq_2msl);
+
+#ifdef VIMAGE
+	if (curvnet == &vnet_0)
+		return;
+#endif
 
 	tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw),
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
@@ -171,7 +181,6 @@
 		uma_zone_set_max(tcptw_zone, tcptw_auto_size());
 	else
 		uma_zone_set_max(tcptw_zone, maxtcptw);
-	TAILQ_INIT(&twq_2msl);
 }
 
 /*
@@ -624,9 +633,9 @@
 	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
 	INP_LOCK_ASSERT(tw->tw_inpcb);
 	if (rearm)
-		TAILQ_REMOVE(&twq_2msl, tw, tw_2msl);
+		TAILQ_REMOVE(&V_twq_2msl, tw, tw_2msl);
 	tw->tw_time = ticks + 2 * tcp_msl;
-	TAILQ_INSERT_TAIL(&twq_2msl, tw, tw_2msl);
+	TAILQ_INSERT_TAIL(&V_twq_2msl, tw, tw_2msl);
 }
 
 static void
@@ -635,7 +644,7 @@
 	INIT_VNET_INET(curvnet);
 
 	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
-	TAILQ_REMOVE(&twq_2msl, tw, tw_2msl);
+	TAILQ_REMOVE(&V_twq_2msl, tw, tw_2msl);
 }
 
 struct tcptw *
@@ -646,7 +655,7 @@
 
 	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
 	for (;;) {
-		tw = TAILQ_FIRST(&twq_2msl);
+		tw = TAILQ_FIRST(&V_twq_2msl);
 		if (tw == NULL || (!reuse && tw->tw_time > ticks))
 			break;
 		INP_LOCK(tw->tw_inpcb);


More information about the p4-projects mailing list