Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Aug 2009 15:18:49 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Marko Zec <zec@FreeBSD.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 167264 for review
Message-ID:  <4A833FC9.2000308@elischer.org>
In-Reply-To: <200908122202.n7CM2tE5062542@repoman.freebsd.org>
References:  <200908122202.n7CM2tE5062542@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.








Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A833FC9.2000308>