2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

preserve a reference to the node lock across a call to no_references() in

detachnode
This commit is contained in:
David Lawrence
2001-05-05 02:42:38 +00:00
parent 5f539d5fc6
commit e40cd7f5c9

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rbtdb.c,v 1.160 2001/04/24 17:03:54 halley Exp $ */
/* $Id: rbtdb.c,v 1.161 2001/05/05 02:42:38 tale Exp $ */
/*
* Principal Author: Bob Halley
@@ -2821,26 +2821,26 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) {
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
dns_rbtnode_t *node;
isc_boolean_t maybe_free = ISC_FALSE;
isc_mutex_t *lock;
unsigned int locknum;
REQUIRE(VALID_RBTDB(rbtdb));
REQUIRE(targetp != NULL && *targetp != NULL);
node = (dns_rbtnode_t *)(*targetp);
lock = &rbtdb->node_locks[node->locknum].lock;
locknum = node->locknum;
LOCK(lock);
LOCK(&rbtdb->node_locks[locknum].lock);
INSIST(node->references > 0);
node->references--;
if (node->references == 0) {
no_references(rbtdb, node, 0, isc_rwlocktype_none);
if (rbtdb->node_locks[node->locknum].references == 0 &&
rbtdb->node_locks[node->locknum].exiting)
if (rbtdb->node_locks[locknum].references == 0 &&
rbtdb->node_locks[locknum].exiting)
maybe_free = ISC_TRUE;
}
UNLOCK(lock);
UNLOCK(&rbtdb->node_locks[locknum].lock);
*targetp = NULL;