From owner-p4-projects@FreeBSD.ORG Mon Jul 2 01:32:57 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5776816A46C; Mon, 2 Jul 2007 01:32:57 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 12B5E16A468 for ; Mon, 2 Jul 2007 01:32:57 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 025F513C45E for ; Mon, 2 Jul 2007 01:32:57 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l621WuwK036259 for ; Mon, 2 Jul 2007 01:32:56 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l621WuTr036256 for perforce@freebsd.org; Mon, 2 Jul 2007 01:32:56 GMT (envelope-from zec@FreeBSD.org) Date: Mon, 2 Jul 2007 01:32:56 GMT Message-Id: <200707020132.l621WuTr036256@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 122694 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2007 01:32:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=122694 Change 122694 by zec@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);