2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

937. [bug] A race when shutting down a zone could trigger a

INSIST() failure. [RT #1034]
This commit is contained in:
Mark Andrews
2001-07-17 02:49:44 +00:00
parent 6529f9ffb6
commit 0176adc7c5
2 changed files with 13 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
937. [bug] A race when shutting down a zone could trigger a
INSIST() failure. [RT #1034]
936. [func] Warn about IPv4 addresses that are not complete 936. [func] Warn about IPv4 addresses that are not complete
dotted quads. [RT #1084] dotted quads. [RT #1084]

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: zone.c,v 1.329 2001/07/11 23:15:14 marka Exp $ */ /* $Id: zone.c,v 1.330 2001/07/17 02:49:44 marka Exp $ */
#include <config.h> #include <config.h>
@@ -560,12 +560,11 @@ zone_free(dns_zone_t *zone) {
REQUIRE(isc_refcount_current(&zone->erefs) == 0); REQUIRE(isc_refcount_current(&zone->erefs) == 0);
REQUIRE(zone->irefs == 0); REQUIRE(zone->irefs == 0);
REQUIRE(!LOCKED_ZONE(zone)); REQUIRE(!LOCKED_ZONE(zone));
REQUIRE(zone->timer == NULL);
/* /*
* Managed objects. Order is important. * Managed objects. Order is important.
*/ */
if (zone->timer != NULL)
isc_timer_detach(&zone->timer);
if (zone->request != NULL) if (zone->request != NULL)
dns_request_destroy(&zone->request); /* XXXMPA */ dns_request_destroy(&zone->request); /* XXXMPA */
INSIST(zone->readio == NULL); INSIST(zone->readio == NULL);
@@ -1545,6 +1544,7 @@ zone_iattach(dns_zone_t *source, dns_zone_t **target) {
REQUIRE(LOCKED_ZONE(source)); REQUIRE(LOCKED_ZONE(source));
REQUIRE(DNS_ZONE_VALID(source)); REQUIRE(DNS_ZONE_VALID(source));
REQUIRE(target != NULL && *target == NULL); REQUIRE(target != NULL && *target == NULL);
INSIST(source->irefs + isc_refcount_current(&source->erefs) > 0);
source->irefs++; source->irefs++;
INSIST(source->irefs != 0); INSIST(source->irefs != 0);
*target = source; *target = source;
@@ -3668,7 +3668,6 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
static void static void
zone_shutdown(isc_task_t *task, isc_event_t *event) { zone_shutdown(isc_task_t *task, isc_event_t *event) {
dns_zone_t *zone = (dns_zone_t *) event->ev_arg; dns_zone_t *zone = (dns_zone_t *) event->ev_arg;
isc_result_t result;
isc_boolean_t free_needed; isc_boolean_t free_needed;
UNUSED(task); UNUSED(task);
@@ -3720,9 +3719,9 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) {
notify_cancel(zone); notify_cancel(zone);
if (zone->timer != NULL) { if (zone->timer != NULL) {
result = isc_timer_reset(zone->timer, isc_timertype_inactive, isc_timer_detach(&zone->timer);
NULL, NULL, ISC_TRUE); INSIST(zone->irefs > 0);
RUNTIME_CHECK(result == ISC_R_SUCCESS); zone->irefs--;
} }
if (zone->view != NULL) if (zone->view != NULL)
@@ -5403,6 +5402,11 @@ dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
&zone->timer); &zone->timer);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto cleanup_task; goto cleanup_task;
/*
* The timer "holds" a iref.
*/
zone->irefs++;
INSIST(zone->irefs != 0);
ISC_LIST_APPEND(zmgr->zones, zone, link); ISC_LIST_APPEND(zmgr->zones, zone, link);
zone->zmgr = zmgr; zone->zmgr = zmgr;