Date: Sat, 20 Feb 2010 21:45:04 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r204143 - head/sys/netinet Message-ID: <201002202145.o1KLj4Jp026891@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sat Feb 20 21:45:04 2010 New Revision: 204143 URL: http://svn.freebsd.org/changeset/base/204143 Log: Upon virtual network stack teardown properly release the TCP syncache resources. Sponsored by: ISPsystem Reviewed by: rwatson MFC After: 5 days Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sat Feb 20 21:43:36 2010 (r204142) +++ head/sys/netinet/tcp_syncache.c Sat Feb 20 21:45:04 2010 (r204143) @@ -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?201002202145.o1KLj4Jp026891>