From: Witold Kręcicki Date: Tue, 30 Jun 2020 12:24:12 +0000 (+0200) Subject: rbtdb: cleanup_dead_nodes should ignore alive nodes on the deadlist X-Git-Tag: v9.17.3~21^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8f2d55acf79678801bff0786049451b595563b2;p=thirdparty%2Fbind9.git rbtdb: cleanup_dead_nodes should ignore alive nodes on the deadlist --- diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 87fbdb317b9..c0b34796841 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -1914,15 +1914,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);