]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
rbtdb: cleanup_dead_nodes should ignore alive nodes on the deadlist
authorWitold Kręcicki <wpk@isc.org>
Tue, 30 Jun 2020 12:24:12 +0000 (14:24 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 1 Jul 2020 13:35:21 +0000 (15:35 +0200)
(cherry picked from commit c8f2d55acf79678801bff0786049451b595563b2)

lib/dns/rbtdb.c

index f9c8f0c7a7f3f05b6653b81e3ff6ba97d365bbf6..3fb4a1d774dacaa884f59d5b44ec7e8b383d9fba 100644 (file)
@@ -1915,15 +1915,16 @@ cleanup_dead_nodes(dns_rbtdb_t *rbtdb, int bucketnum) {
                ISC_LIST_UNLINK(rbtdb->deadnodes[bucketnum], node, deadlink);
 
                /*
-                * Since we're holding a tree write lock, it should be
-                * impossible for this node to be referenced by others.
-                *
-                * decrement_reference may not have tested node->down, as
-                * the tree_lock was not held, before adding the node to
-                * deadnodes so we test it here.
+                * We might have reactivated this node without a tree write
+                * lock, so we couldn't remove this node from deadnodes then
+                * and we have to do it now.
                 */
-               INSIST(isc_refcount_current(&node->references) == 0 &&
-                      node->data == NULL);
+               if (isc_refcount_current(&node->references) != 0 ||
+                   node->data != NULL) {
+                       node = ISC_LIST_HEAD(rbtdb->deadnodes[bucketnum]);
+                       count--;
+                       continue;
+               }
 
                if (is_leaf(node) && rbtdb->task != NULL) {
                        send_to_prune_tree(rbtdb, node, isc_rwlocktype_write);