diff options
author | bz <bz@FreeBSD.org> | 2016-06-23 00:34:03 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2016-06-23 00:34:03 +0000 |
commit | 82f8e327104faac208f0bc8173908a3055fbb3de (patch) | |
tree | 653c2876f9862e98ac3041b99637e00017b7bd9d /sys/netinet/tcp_subr.c | |
parent | cd2b4aba5e1be4c521bed1311eac0ea126d1c694 (diff) | |
download | FreeBSD-src-82f8e327104faac208f0bc8173908a3055fbb3de.zip FreeBSD-src-82f8e327104faac208f0bc8173908a3055fbb3de.tar.gz |
Check the V_tcbinfo.ipi_count to hit 0 before doing the full TCP cleanup.
That way timers can finish cleanly and we do not gamble with a DELAY().
Reviewed by: gnn, jtl
Approved by: re (gjb)
Obtained from: projects/vnet
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6923
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 7863f1c..f219e6b 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -731,18 +731,19 @@ tcp_init(void) static void tcp_destroy(void *unused __unused) { - int error; + int error, n; /* * All our processes are gone, all our sockets should be cleaned * up, which means, we should be past the tcp_discardcb() calls. - * Sleep to let all tcpcb timers really disappear and then cleanup. - * Timewait will cleanup its queue and will be ready to go. - * XXX-BZ In theory a few ticks should be good enough to make sure - * the timers are all really gone. We should see if we could use a - * better metric here and, e.g., check a tcbcb count as an optimization? + * Sleep to let all tcpcb timers really disappear and cleanup. */ - DELAY(1000000 / hz); + do { + pause("tcpdes", hz/10); + INP_LIST_RLOCK(&V_tcbinfo); + n = V_tcbinfo.ipi_count; + INP_LIST_RUNLOCK(&V_tcbinfo); + } while (n != 0); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); |