From 0ea634a5db38d44c7922a718872f64da2b644006 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Sat, 4 May 2024 00:56:45 -0700 Subject: [PATCH] reduce node locking some calls to bindrdataset were node-locked; this is no longer necessary. --- lib/dns/qpcache.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index 775da0f3d7..c01b668188 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -921,14 +921,6 @@ bindrdataset(qpcache_t *qpdb, qpcnode_t *node, dns_slabheader_t *header, bool stale = STALE(header); bool ancient = ANCIENT(header); - /* - * Caller must be holding the node reader lock. - * XXXJT: technically, we need a writer lock, since we'll increment - * the header count below. However, since the actual counter value - * doesn't matter, we prioritize performance here. (We may want to - * use atomic increment when available). - */ - if (rdataset == NULL) { return; } @@ -1029,10 +1021,6 @@ setup_delegation(qpc_search_t *search, dns_dbnode_t **nodep, REQUIRE(search->zonecut != NULL); REQUIRE(search->zonecut_header != NULL); - /* - * The caller MUST NOT be holding any node locks. - */ - node = search->zonecut; type = search->zonecut_header->type; @@ -1046,20 +1034,15 @@ setup_delegation(qpc_search_t *search, dns_dbnode_t **nodep, search->need_cleanup = false; } if (rdataset != NULL) { - isc_rwlocktype_t nlocktype = isc_rwlocktype_none; - NODE_RDLOCK(&(search->qpdb->node_locks[node->locknum].lock), - &nlocktype); bindrdataset(search->qpdb, node, search->zonecut_header, - search->now, NULL, nlocktype, + search->now, NULL, isc_rwlocktype_none, rdataset DNS__DB_FLARG_PASS); if (sigrdataset != NULL && search->zonecut_sigheader != NULL) { bindrdataset(search->qpdb, node, search->zonecut_sigheader, search->now, - NULL, nlocktype, + NULL, isc_rwlocktype_none, sigrdataset DNS__DB_FLARG_PASS); } - NODE_UNLOCK(&(search->qpdb->node_locks[node->locknum].lock), - &nlocktype); } if (type == dns_rdatatype_dname) { @@ -3837,17 +3820,12 @@ rdatasetiter_current(dns_rdatasetiter_t *iterator, qpcache_t *qpdb = (qpcache_t *)(rbtiterator->common.db); qpcnode_t *qpnode = rbtiterator->common.node; dns_slabheader_t *header = NULL; - isc_rwlocktype_t nlocktype = isc_rwlocktype_none; header = rbtiterator->current; REQUIRE(header != NULL); - NODE_RDLOCK(&qpdb->node_locks[qpnode->locknum].lock, &nlocktype); - bindrdataset(qpdb, qpnode, header, rbtiterator->common.now, NULL, - nlocktype, rdataset DNS__DB_FLARG_PASS); - - NODE_UNLOCK(&qpdb->node_locks[qpnode->locknum].lock, &nlocktype); + isc_rwlocktype_none, rdataset DNS__DB_FLARG_PASS); } /*