2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

don't unlock the node lock in no_references() [RT #2018]

This commit is contained in:
Andreas Gustafsson
2001-11-16 00:17:07 +00:00
parent a831ffc8fe
commit db40c6bfdf

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: rbtdb.c,v 1.172 2001/11/12 19:05:27 gson Exp $ */ /* $Id: rbtdb.c,v 1.173 2001/11/16 00:17:07 gson Exp $ */
/* /*
* Principal Author: Bob Halley * Principal Author: Bob Halley
@@ -766,7 +766,6 @@ no_references(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
{ {
isc_result_t result; isc_result_t result;
isc_boolean_t write_locked; isc_boolean_t write_locked;
isc_boolean_t reacquire;
unsigned int locknum; unsigned int locknum;
/* /*
@@ -806,15 +805,12 @@ no_references(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
/* /*
* XXXDCL need to add a deferred delete method for ISC_R_LOCKBUSY. * XXXDCL need to add a deferred delete method for ISC_R_LOCKBUSY.
*/ */
reacquire = ISC_FALSE;
if (lock != isc_rwlocktype_write) { if (lock != isc_rwlocktype_write) {
/* /*
* Free the node lock before acquiring a tree write lock, per * Locking hierarchy notwithstanding, we don't need to free
* the lock hierarchy rules stated at the start of this file. * the node lock before acquiring the tree write lock because
* we only do a trylock.
*/ */
UNLOCK(&rbtdb->node_locks[locknum].lock);
reacquire = ISC_TRUE;
if (lock == isc_rwlocktype_read) if (lock == isc_rwlocktype_read)
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
@@ -824,7 +820,6 @@ no_references(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
result == ISC_R_LOCKBUSY); result == ISC_R_LOCKBUSY);
write_locked = ISC_TF(result == ISC_R_SUCCESS); write_locked = ISC_TF(result == ISC_R_SUCCESS);
} else } else
write_locked = ISC_TRUE; write_locked = ISC_TRUE;
@@ -857,12 +852,6 @@ no_references(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
if (lock == isc_rwlocktype_read) if (lock == isc_rwlocktype_read)
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
/*
* Reacquire the node lock that the caller held if necessary.
*/
if (reacquire)
LOCK(&rbtdb->node_locks[locknum].lock);
} }
static inline void static inline void