From owner-p4-projects@FreeBSD.ORG Wed Aug 12 22:18:51 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DB5E310656C0; Wed, 12 Aug 2009 22:18:50 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93A051065679 for ; Wed, 12 Aug 2009 22:18:50 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outS.internet-mail-service.net (outs.internet-mail-service.net [216.240.47.242]) by mx1.freebsd.org (Postfix) with ESMTP id 7DA618FC62 for ; Wed, 12 Aug 2009 22:18:50 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 477C5B5A31; Wed, 12 Aug 2009 15:18:50 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id C66792D6006; Wed, 12 Aug 2009 15:18:49 -0700 (PDT) Message-ID: <4A833FC9.2000308@elischer.org> Date: Wed, 12 Aug 2009 15:18:49 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Marko Zec References: <200908122202.n7CM2tE5062542@repoman.freebsd.org> In-Reply-To: <200908122202.n7CM2tE5062542@repoman.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Perforce Change Reviews Subject: Re: PERFORCE change 167264 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: Wed, 12 Aug 2009 22:18:52 -0000 Marko Zec wrote: > http://perforce.freebsd.org/chv.cgi?CH=167264 > > Change 167264 by zec@zec_tpx32 on 2009/08/12 22:02:24 > > Release resources / memory when vnets are destroyed. > > Affected files ... > > .. //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#39 edit > > Differences ... > > ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#39 (text+ko) ==== > > @@ -185,6 +185,17 @@ > uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets); > } > > +static void > +div_destroy(void) > +{ > + > + INP_INFO_LOCK_DESTROY(&V_divcbinfo); > + uma_zdestroy(V_divcbinfo.ipi_zone); > + hashdestroy(V_divcbinfo.ipi_hashbase, M_PCB, V_divcbinfo.ipi_hashmask); > + hashdestroy(V_divcbinfo.ipi_porthashbase, M_PCB, > + V_divcbinfo.ipi_porthashmask); > +} > + > /* > * IPPROTO_DIVERT is not in the real IP protocol number space; this > * function should never be called. Just in case, drop any packets. > @@ -716,6 +727,9 @@ > .pr_ctlinput = div_ctlinput, > .pr_ctloutput = ip_ctloutput, > .pr_init = div_init, > +#ifdef VIMAGE > + .pr_destroy = div_destroy, > +#endif > .pr_usrreqs = &div_usrreqs > }; > > @@ -775,8 +789,7 @@ > ip_divert_ptr = NULL; > err = pf_proto_unregister(PF_INET, IPPROTO_DIVERT, SOCK_RAW); > INP_INFO_WUNLOCK(&V_divcbinfo); > - INP_INFO_LOCK_DESTROY(&V_divcbinfo); > - uma_zdestroy(V_divcbinfo.ipi_zone); > + div_destroy(); > EVENTHANDLER_DEREGISTER(maxsockets_change, ip_divert_event_tag); > break; > #endif /* !VIMAGE */ to avoid this problem Robert added: VNET_DOMAIN_SET(inet) which does this for domains. and he uses elsewhere.