From owner-p4-projects@FreeBSD.ORG Wed Aug 12 22:02:56 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7A2321065678; Wed, 12 Aug 2009 22:02:56 +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 3AA731065676 for ; Wed, 12 Aug 2009 22:02:56 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2B2268FC1F for ; Wed, 12 Aug 2009 22:02:56 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n7CM2ujs062544 for ; Wed, 12 Aug 2009 22:02:56 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7CM2tE5062542 for perforce@freebsd.org; Wed, 12 Aug 2009 22:02:55 GMT (envelope-from zec@fer.hr) Date: Wed, 12 Aug 2009 22:02:55 GMT Message-Id: <200908122202.n7CM2tE5062542@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: 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:02:57 -0000 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 */