ip_reass: don't drain all vnets on a vnet destroy

This commit is contained in:
Gleb Smirnoff 2022-08-21 07:44:58 -07:00
parent 3454a7caa0
commit 6498153665

View File

@ -599,6 +599,21 @@ ipreass_timer_init(void *arg __unused)
callout_reset_sbt(&ipreass_callout, SBT_1MS * 500, SBT_1MS * 10,
ipreass_slowtimo, NULL, 0);
}
static void
ipreass_drain_vnet(void)
{
for (int i = 0; i < IPREASS_NHASH; i++) {
IPQ_LOCK(i);
while(!TAILQ_EMPTY(&V_ipq[i].head))
ipq_drop(&V_ipq[i], TAILQ_FIRST(&V_ipq[i].head));
KASSERT(V_ipq[i].count == 0,
("%s: V_ipq[%d] count %d (V_ipq=%p)", __func__, i,
V_ipq[i].count, V_ipq));
IPQ_UNLOCK(i);
}
}
SYSINIT(ipreass, SI_SUB_VNET_DONE, SI_ORDER_ANY, ipreass_timer_init, NULL);
/*
@ -611,16 +626,7 @@ ipreass_drain(void)
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
for (int i = 0; i < IPREASS_NHASH; i++) {
IPQ_LOCK(i);
while(!TAILQ_EMPTY(&V_ipq[i].head))
ipq_drop(&V_ipq[i],
TAILQ_FIRST(&V_ipq[i].head));
KASSERT(V_ipq[i].count == 0,
("%s: V_ipq[%d] count %d (V_ipq=%p)", __func__, i,
V_ipq[i].count, V_ipq));
IPQ_UNLOCK(i);
}
ipreass_drain_vnet();
CURVNET_RESTORE();
}
}
@ -710,7 +716,7 @@ void
ipreass_destroy(void)
{
ipreass_drain();
ipreass_drain_vnet();
uma_zdestroy(V_ipq_zone);
V_ipq_zone = NULL;
for (int i = 0; i < IPREASS_NHASH; i++)