currently it leaves early if it is the last entry being removed,
which is an optimisation. in the future it is possible for another
cpu to have a reference to the table while the last reference is
being dropped, so we need to scrub it in case it gets read.

ok?

Index: art.c
===================================================================
RCS file: /cvs/src/sys/net/art.c,v
retrieving revision 1.14
diff -u -p -r1.14 art.c
--- art.c       13 Apr 2016 08:04:14 -0000      1.14
+++ art.c       1 Jun 2016 05:26:51 -0000
@@ -490,10 +490,6 @@ art_table_delete(struct art_root *ar, st
        KASSERT(prev == node);
 #endif
 
-       /* We are removing an entry from this table. */
-       if (art_table_free(ar, at))
-               return (node);
-
        /* Get the next most specific route for the index `i'. */
        if ((i >> 1) > 1)
                next = at->at_heap[i >> 1].node;
@@ -512,6 +508,9 @@ art_table_delete(struct art_root *ar, st
        else
                at->at_heap[i].node = next;
 
+       /* We have removed an entry from this table. */
+       art_table_free(ar, at);
+
        return (node);
 }
 

Reply via email to