]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Cleanup the dead nodes when pruning the tree
authorOndřej Surý <ondrej@isc.org>
Wed, 2 Nov 2022 12:04:56 +0000 (13:04 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 2 Nov 2022 12:06:52 +0000 (13:06 +0100)
While sending the node to prune_tree(), we can also cleanup dead nodes
because we already hold the tree and node bucket write locks.

lib/dns/rbtdb.c

index f446b822e9b3504281d8ef30cefbfba7d51724c5..abe0296914e214329442369d65ee6f5d8c805126 100644 (file)
@@ -2254,6 +2254,12 @@ prune_tree(isc_task_t *task, isc_event_t *event) {
                decrement_reference(rbtdb, node, 0, &nlocktype, &tlocktype,
                                    true);
 
+               /*
+                * We have both write locks, we might as well do a light
+                * dead nodes cleaning.
+                */
+               cleanup_dead_nodes(rbtdb, locknum);
+
                if (parent != NULL && parent->down == NULL) {
                        /*
                         * node was the only down child of the parent and has