From: Andreas Gustafsson Date: Wed, 11 Jul 2001 01:23:56 +0000 (+0000) Subject: pullup: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c2db56e9cbb71c8954b6ddc1a22fa75031e737b;p=thirdparty%2Fbind9.git pullup: 926. [bug] The resolver could deadlock with the ADB when shutting down (multithreaded builds only). [RT #1324] --- diff --git a/CHANGES b/CHANGES index 90f7da4d8a3..08088df2943 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ + 926. [bug] The resolver could deadlock with the ADB when + shutting down (multithreaded builds only). + [RT #1324] + 924. [port] Extend support for pre-RFC2133 IPv6 implementation. [RT #987] diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index a1d371e86d6..1ac71d425aa 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.187.2.10 2001/05/29 23:07:33 bwelling Exp $ */ +/* $Id: resolver.c,v 1.187.2.11 2001/07/11 01:23:56 gson Exp $ */ #include @@ -1886,6 +1886,13 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { validator = ISC_LIST_NEXT(validator, link); } + /* + * Shut down anything that is still running on behalf of this + * fetch. To avoid deadlock with the ADB, we must do this + * before we lock the bucket lock. + */ + fctx_stopeverything(fctx, ISC_FALSE); + LOCK(&res->buckets[bucketnum].lock); INSIST(fctx->state == fetchstate_active || @@ -1893,7 +1900,6 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { INSIST(fctx->want_shutdown); if (fctx->state != fetchstate_done) { - fctx_stopeverything(fctx, ISC_FALSE); fctx->state = fetchstate_done; fctx_sendevents(fctx, ISC_R_CANCELED); }