]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3025. [bug] Fixed a possible deadlock due to zone resigning.
authorEvan Hunt <each@isc.org>
Fri, 18 Feb 2011 23:26:44 +0000 (23:26 +0000)
committerEvan Hunt <each@isc.org>
Fri, 18 Feb 2011 23:26:44 +0000 (23:26 +0000)
[RT #22964]

CHANGES
lib/dns/rbtdb.c
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index db76a717c3c1b54d85b6e81e17a47a95eb65919f..03c5308bcefa27826746419cc883ce4c14c435ec 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
-3024. [func]           RTT Banding removed due to minor security increase
+3025.  [bug]           Fixed a possible deadlock due to zone resigning.
+                       [RT #22964]
+
+3024.   [func]         RTT Banding removed due to minor security increase
                        but major impact on resolver latency. [RT #23310]
 
 3023.  [bug]           Named could be left in an inconsistent state when
index b131921cfdf887cd72252d350ba48fe17848a6bd..c234eb19956c61eb4a4ee6b209258d473d87ba4f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbtdb.c,v 1.310 2011/01/13 09:53:04 marka Exp $ */
+/* $Id: rbtdb.c,v 1.311 2011/02/18 23:26:44 each Exp $ */
 
 /*! \file */
 
@@ -392,12 +392,15 @@ typedef ISC_LIST(rbtdb_version_t)       rbtdb_versionlist_t;
 typedef struct {
        /* Unlocked. */
        dns_db_t                        common;
+       /* Locks the data in this struct */
 #if DNS_RBTDB_USERWLOCK
        isc_rwlock_t                    lock;
 #else
        isc_mutex_t                     lock;
 #endif
+       /* Locks the tree structure (prevents nodes appearing/disappearing) */
        isc_rwlock_t                    tree_lock;
+       /* Locks for individual tree nodes */
        unsigned int                    node_lock_count;
        rbtdb_nodelock_t *              node_locks;
        dns_rbtnode_t *                 origin_node;
@@ -7264,7 +7267,7 @@ getsigningtime(dns_db_t *db, dns_rdataset_t *rdataset,
 
        REQUIRE(VALID_RBTDB(rbtdb));
 
-       RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_read);
+       RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
 
        for (i = 0; i < rbtdb->node_lock_count; i++) {
                NODE_LOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_read);
@@ -7300,7 +7303,7 @@ getsigningtime(dns_db_t *db, dns_rdataset_t *rdataset,
        result = ISC_R_SUCCESS;
 
  unlock:
-       RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_read);
+       RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
 
        return (result);
 }
@@ -7322,7 +7325,7 @@ resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version)
        header = rdataset->private3;
        header--;
 
-       RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write);
+       RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
        NODE_LOCK(&rbtdb->node_locks[node->locknum].lock,
                  isc_rwlocktype_write);
        /*
@@ -7336,7 +7339,7 @@ resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version)
 
        NODE_UNLOCK(&rbtdb->node_locks[node->locknum].lock,
                    isc_rwlocktype_write);
-       RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write);
+       RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
 }
 
 static dns_stats_t *
index 53d5a17c2034b491393d537eaf1aa760b0a599ad..2993b08121d712931dabdc621d6ac58197990407 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zone.c,v 1.588 2011/02/17 23:47:24 tbox Exp $ */
+/* $Id: zone.c,v 1.589 2011/02/18 23:26:44 each Exp $ */
 
 /*! \file */
 
@@ -7916,7 +7916,8 @@ void
 dns_zone_markdirty(dns_zone_t *zone) {
 
        LOCK_ZONE(zone);
-       set_resigntime(zone);   /* XXXMPA make separate call back */
+       if (zone->type == dns_zone_master)
+               set_resigntime(zone);   /* XXXMPA make separate call back */
        zone_needdump(zone, DNS_DUMP_DELAY);
        UNLOCK_ZONE(zone);
 }