2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Stop processing catalog zone changes when shutting down

Abandon catz_addmodzone_cb  and catz_delzone_cb processing if the
loop is shutting down.
This commit is contained in:
Mark Andrews 2024-05-07 16:48:17 +10:00
parent 941ad2b3c5
commit 88c48dde5e
3 changed files with 34 additions and 5 deletions

View File

@ -2656,6 +2656,10 @@ catz_addmodzone_cb(void *arg) {
ns_cfgctx_t *cfg = NULL;
dns_zone_t *zone = NULL;
if (isc_loop_shuttingdown(isc_loop_get(named_g_loopmgr, isc_tid()))) {
goto cleanup;
}
cfg = (ns_cfgctx_t *)cz->view->new_zone_config;
if (cfg == NULL) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@ -2865,6 +2869,10 @@ catz_delzone_cb(void *arg) {
char cname[DNS_NAME_FORMATSIZE];
const char *file = NULL;
if (isc_loop_shuttingdown(isc_loop_get(named_g_loopmgr, isc_tid()))) {
goto cleanup;
}
isc_loopmgr_pause(named_g_loopmgr);
dns_name_format(dns_catz_entry_getname(cz->entry), cname,
@ -2877,7 +2885,7 @@ catz_delzone_cb(void *arg) {
"catz: catz_delzone_cb: "
"zone '%s' not found",
cname);
goto cleanup;
goto resume;
}
if (!dns_zone_getadded(zone)) {
@ -2886,7 +2894,7 @@ catz_delzone_cb(void *arg) {
"catz: catz_delzone_cb: "
"zone '%s' is not a dynamically added zone",
cname);
goto cleanup;
goto resume;
}
if (dns_zone_get_parentcatz(zone) != cz->origin) {
@ -2895,7 +2903,7 @@ catz_delzone_cb(void *arg) {
"catz: catz_delzone_cb: zone "
"'%s' exists in multiple catalog zones",
cname);
goto cleanup;
goto resume;
}
/* Stop answering for this zone */
@ -2904,7 +2912,9 @@ catz_delzone_cb(void *arg) {
dns_zone_unload(zone);
}
CHECK(dns_view_delzone(cz->view, zone));
if (dns_view_delzone(cz->view, zone) != ISC_R_SUCCESS) {
goto resume;
}
file = dns_zone_getfile(zone);
if (file != NULL) {
isc_file_remove(file);
@ -2919,8 +2929,9 @@ catz_delzone_cb(void *arg) {
"catz: catz_delzone_cb: "
"zone '%s' deleted",
cname);
cleanup:
resume:
isc_loopmgr_resume(named_g_loopmgr);
cleanup:
if (zone != NULL) {
dns_zone_detach(&zone);
}

View File

@ -215,4 +215,14 @@ isc_loop_now(isc_loop_t *loop);
*
* \li 'loop' is a valid loop.
*/
bool
isc_loop_shuttingdown(isc_loop_t *loop);
/*%<
* Returns whether the loop is shutting down.
*
* Requires:
*
* \li 'loop' is a valid loop and the loop tid matches the current tid.
*/
ISC_LANG_ENDDECLS

View File

@ -616,3 +616,11 @@ isc_loop_now(isc_loop_t *loop) {
return (t);
}
bool
isc_loop_shuttingdown(isc_loop_t *loop) {
REQUIRE(VALID_LOOP(loop));
REQUIRE(loop->tid == isc_tid());
return (loop->shuttingdown);
}