2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 23:25:38 +00:00

1436. [func] dns_zonemgr_resumexfrs() can be used to restart

stalled transfers.

1435.   [bug]           zmgr_resume_xfrs() was being called read locked
                        rather than write locked.  zmgr_resume_xfrs()
                        was not being called if the zone was being
                        shutdown.

1434.   [bug]           "rndc reconfig" failed to initiate the initial
                        zone transfer of new slave zones.
developer: marka
reviewer: explorer
This commit is contained in:
Mark Andrews
2003-02-26 03:45:59 +00:00
parent e0dde035d9
commit c3ea698877
4 changed files with 74 additions and 14 deletions

11
CHANGES
View File

@@ -1,3 +1,14 @@
1436. [func] dns_zonemgr_resumexfrs() can be used to restart
stalled transfers.
1435. [bug] zmgr_resume_xfrs() was being called read locked
rather than write locked. zmgr_resume_xfrs()
was not being called if the zone was being
shutdown.
1434. [bug] "rndc reconfig" failed to initiate the initial
zone transfer of new slave zones.
1433. [bug] named could trigger a REQUIRE failure if it could 1433. [bug] named could trigger a REQUIRE failure if it could
not get a file descriptor when attempting to write not get a file descriptor when attempting to write
a master file. [RT #4347] a master file. [RT #4347]

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: server.c,v 1.395 2003/02/26 02:03:58 marka Exp $ */ /* $Id: server.c,v 1.396 2003/02/26 03:45:58 marka Exp $ */
#include <config.h> #include <config.h>
@@ -2408,7 +2408,7 @@ load_new_zones(ns_server_t *server, isc_boolean_t stop) {
* so that we know when we need to force AXFR of * so that we know when we need to force AXFR of
* slave zones whose master files are missing. * slave zones whose master files are missing.
*/ */
CHECK(dns_zonemgr_forcemaint(server->zonemgr)); dns_zonemgr_resumexfrs(server->zonemgr);
cleanup: cleanup:
isc_task_endexclusive(server->task); isc_task_endexclusive(server->task);
return (result); return (result);

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: zone.h,v 1.121 2003/02/07 01:13:12 marka Exp $ */ /* $Id: zone.h,v 1.122 2003/02/26 03:45:59 marka Exp $ */
#ifndef DNS_ZONE_H #ifndef DNS_ZONE_H
#define DNS_ZONE_H 1 #define DNS_ZONE_H 1
@@ -1167,6 +1167,12 @@ dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr);
* earliest conveniene. * earliest conveniene.
*/ */
void
dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr);
/*
* Attempt to start any stalled zone transfers.
*/
void void
dns_zonemgr_shutdown(dns_zonemgr_t *zmgr); dns_zonemgr_shutdown(dns_zonemgr_t *zmgr);
/* /*

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.383 2003/02/26 03:06:46 marka Exp $ */ /* $Id: zone.c,v 1.384 2003/02/26 03:45:59 marka Exp $ */
#include <config.h> #include <config.h>
@@ -414,7 +414,7 @@ static isc_result_t zone_dump(dns_zone_t *, isc_boolean_t);
static void got_transfer_quota(isc_task_t *task, isc_event_t *event); static void got_transfer_quota(isc_task_t *task, isc_event_t *event);
static isc_result_t zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr, static isc_result_t zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr,
dns_zone_t *zone); dns_zone_t *zone);
static void zmgr_resume_xfrs(dns_zonemgr_t *zmgr); static void zmgr_resume_xfrs(dns_zonemgr_t *zmgr, isc_boolean_t multi);
static void zonemgr_free(dns_zonemgr_t *zmgr); static void zonemgr_free(dns_zonemgr_t *zmgr);
static isc_result_t zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high, static isc_result_t zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high,
isc_task_t *task, isc_taskaction_t action, isc_task_t *task, isc_taskaction_t action,
@@ -995,6 +995,34 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
} }
} }
INSIST(zone->db_argc >= 1);
if ((zone->type == dns_zone_slave || zone->type == dns_zone_stub) &&
(strcmp(zone->db_argv[0], "rbt") == 0 ||
strcmp(zone->db_argv[0], "rbt64") == 0)) {
if (zone->masterfile != NULL) {
result = isc_file_exists(zone->masterfile);
} else {
start_timers:
if (zone->task != NULL)
zone_settimer(zone, &now);
result = ISC_R_SUCCESS;
goto cleanup;
}
if (result == ISC_R_FILENOTFOUND) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"no master file");
goto start_timers;
} else if (result != ISC_R_SUCCESS) {
dns_zone_log(zone, ISC_LOG_ERROR,
"loading master file %s: %s",
zone->masterfile,
dns_result_totext(result));
result = ISC_R_SUCCESS;
goto start_timers;
}
}
dns_zone_log(zone, ISC_LOG_DEBUG(1), "starting load"); dns_zone_log(zone, ISC_LOG_DEBUG(1), "starting load");
/* /*
@@ -1005,7 +1033,6 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
*/ */
TIME_NOW(&loadtime); TIME_NOW(&loadtime);
INSIST(zone->db_argc >= 1);
result = dns_db_create(zone->mctx, zone->db_argv[0], result = dns_db_create(zone->mctx, zone->db_argv[0],
&zone->origin, (zone->type == dns_zone_stub) ? &zone->origin, (zone->type == dns_zone_stub) ?
dns_dbtype_stub : dns_dbtype_zone, dns_dbtype_stub : dns_dbtype_zone,
@@ -1408,6 +1435,8 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
/* Mark the zone for immediate refresh. */ /* Mark the zone for immediate refresh. */
zone->refreshtime = now; zone->refreshtime = now;
if (zone->task != NULL)
zone_settimer(zone, &now);
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;
} }
return (result); return (result);
@@ -5215,8 +5244,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
RWLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write); RWLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write);
ISC_LIST_UNLINK(zone->zmgr->xfrin_in_progress, zone, statelink); ISC_LIST_UNLINK(zone->zmgr->xfrin_in_progress, zone, statelink);
zone->statelist = NULL; zone->statelist = NULL;
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) zmgr_resume_xfrs(zone->zmgr, ISC_FALSE);
zmgr_resume_xfrs(zone->zmgr);
RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write); RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write);
/* /*
@@ -5886,6 +5914,7 @@ dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr) {
{ {
dns_zone_maintenance(p); dns_zone_maintenance(p);
} }
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read);
/* /*
* Recent configuration changes may have increased the * Recent configuration changes may have increased the
@@ -5893,12 +5922,22 @@ dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr) {
* transfers currently blocked on quota get started if * transfers currently blocked on quota get started if
* possible. * possible.
*/ */
zmgr_resume_xfrs(zmgr); RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
zmgr_resume_xfrs(zmgr, ISC_TRUE);
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read); RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
void
dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr) {
REQUIRE(DNS_ZONEMGR_VALID(zmgr));
RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
zmgr_resume_xfrs(zmgr, ISC_TRUE);
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
}
void void
dns_zonemgr_shutdown(dns_zonemgr_t *zmgr) { dns_zonemgr_shutdown(dns_zonemgr_t *zmgr) {
REQUIRE(DNS_ZONEMGR_VALID(zmgr)); REQUIRE(DNS_ZONEMGR_VALID(zmgr));
@@ -5965,16 +6004,20 @@ dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr) {
* The zone manager is locked by the caller. * The zone manager is locked by the caller.
*/ */
static void static void
zmgr_resume_xfrs(dns_zonemgr_t *zmgr) { zmgr_resume_xfrs(dns_zonemgr_t *zmgr, isc_boolean_t multi) {
dns_zone_t *zone; dns_zone_t *zone;
dns_zone_t *next;
for (zone = ISC_LIST_HEAD(zmgr->waiting_for_xfrin); for (zone = ISC_LIST_HEAD(zmgr->waiting_for_xfrin);
zone != NULL; zone != NULL;
zone = ISC_LIST_NEXT(zone, statelink)) zone = next)
{ {
isc_result_t result; isc_result_t result;
next = ISC_LIST_NEXT(zone, statelink);
result = zmgr_start_xfrin_ifquota(zmgr, zone); result = zmgr_start_xfrin_ifquota(zmgr, zone);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
if (multi)
continue;
/* /*
* We successfully filled the slot. We're done. * We successfully filled the slot. We're done.
*/ */
@@ -5982,7 +6025,7 @@ zmgr_resume_xfrs(dns_zonemgr_t *zmgr) {
} else if (result == ISC_R_QUOTA) { } else if (result == ISC_R_QUOTA) {
/* /*
* Not enough quota. This is probably the per-server * Not enough quota. This is probably the per-server
* quota, because we only get called when a unit of * quota, because we usually get called when a unit of
* global quota has just been freed. Try the next * global quota has just been freed. Try the next
* zone, it may succeed if it uses another master. * zone, it may succeed if it uses another master.
*/ */