The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6498153665fddbcf3efa94a230933a3b8834240b

commit 6498153665fddbcf3efa94a230933a3b8834240b
Author:     Gleb Smirnoff <[email protected]>
AuthorDate: 2022-08-21 14:44:58 +0000
Commit:     Gleb Smirnoff <[email protected]>
CommitDate: 2022-08-21 14:44:58 +0000

    ip_reass: don't drain all vnets on a vnet destroy
---
 sys/netinet/ip_reass.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c
index e581e2e622c7..2589151cc970 100644
--- a/sys/netinet/ip_reass.c
+++ b/sys/netinet/ip_reass.c
@@ -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++)

Reply via email to