From fa31ca157f426256598ef9268bf5c15e5f01d856 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 24 Apr 2012 15:07:43 -0700 Subject: [PATCH] fctx_finddone: call fctx_destroy within the bucket lock --- CHANGES | 6 +++++- lib/dns/resolver.c | 10 ++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index e8537c9f6cd..f11c7815cb9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,11 @@ +3309. [bug] resolver.c:fctx_finddone() was not threadsafe. + [RT #27995] + 3307. [bug] Add missing ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS. [RT #28956] -3304. [bug] Use hmctx, not mctx when freeing rbtdb->heaps. [RT #28571] +3304. [bug] Use hmctx, not mctx when freeing rbtdb->heaps. + [RT #28571] 3301. [contrib] Update queryperf to build on darwin. Add -R flag for non-recursive queries. [RT #28565] diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 105ed6130e4..48029d11ceb 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -2156,7 +2156,6 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { isc_boolean_t want_try = ISC_FALSE; isc_boolean_t want_done = ISC_FALSE; isc_boolean_t bucket_empty = ISC_FALSE; - isc_boolean_t destroy = ISC_FALSE; unsigned int bucketnum; find = event->ev_sender; @@ -2195,17 +2194,12 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { } } else if (SHUTTINGDOWN(fctx) && fctx->pending == 0 && fctx->nqueries == 0 && ISC_LIST_EMPTY(fctx->validators)) { - /* - * Note that we had to wait until we had the lock before - * looking at fctx->references. - */ + if (fctx->references == 0) - destroy = ISC_TRUE; + bucket_empty = fctx_destroy(fctx); } UNLOCK(&res->buckets[bucketnum].lock); - if (destroy) - bucket_empty = fctx_destroy(fctx); isc_event_free(&event); dns_adb_destroyfind(&find); -- 2.47.3