Date: Sat, 27 Mar 2010 17:36:53 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r205755 - stable/8/sys/netinet Message-ID: <201003271736.o2RHarO3053662@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sat Mar 27 17:36:52 2010 New Revision: 205755 URL: http://svn.freebsd.org/changeset/base/205755 Log: MFC r204143: Upon virtual network stack teardown properly release the TCP syncache resources. Reviewed by: rwatson Modified: stable/8/sys/netinet/tcp_syncache.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/tcp_syncache.c ============================================================================== --- stable/8/sys/netinet/tcp_syncache.c Sat Mar 27 17:34:57 2010 (r205754) +++ stable/8/sys/netinet/tcp_syncache.c Sat Mar 27 17:36:52 2010 (r205755) @@ -278,11 +278,33 @@ syncache_init(void) void syncache_destroy(void) { + struct syncache_head *sch; + struct syncache *sc, *nsc; + int i; + + /* Cleanup hash buckets: stop timers, free entries, destroy locks. */ + for (i = 0; i < V_tcp_syncache.hashsize; i++) { + + sch = &V_tcp_syncache.hashbase[i]; + callout_drain(&sch->sch_timer); + + SCH_LOCK(sch); + TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) + syncache_drop(sc, sch); + SCH_UNLOCK(sch); + KASSERT(TAILQ_EMPTY(&sch->sch_bucket), + ("%s: sch->sch_bucket not empty", __func__)); + KASSERT(sch->sch_length == 0, ("%s: sch->sch_length %d not 0", + __func__, sch->sch_length)); + mtx_destroy(&sch->sch_mtx); + } - /* XXX walk the cache, free remaining objects, stop timers */ + KASSERT(V_tcp_syncache.cache_count == 0, ("%s: cache_count %d not 0", + __func__, V_tcp_syncache.cache_count)); + /* Free the allocated global resources. */ uma_zdestroy(V_tcp_syncache.zone); - FREE(V_tcp_syncache.hashbase, M_SYNCACHE); + free(V_tcp_syncache.hashbase, M_SYNCACHE); } #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003271736.o2RHarO3053662>