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

Process db callbacks in zone_loaddone() after zone_postload()

The zone_postload() function can fail and unregister the callbacks.

Call dns_db_endload() only after calling zone_postload() to make
sure that the registered update-notify callbacks are not called
when the zone loading has failed during zone_postload().

Also, don't ignore the return value of zone_postload().
This commit is contained in:
Aram Sargsyan 2023-01-26 19:08:19 +00:00 committed by Arаm Sаrgsyаn
parent a73b67456e
commit ed268b46f1

View File

@ -17225,13 +17225,6 @@ zone_loaddone(void *arg, isc_result_t result) {
dns_zone_catz_disable_db(zone, load->db); dns_zone_catz_disable_db(zone, load->db);
} }
tresult = dns_db_endload(load->db, &load->callbacks);
if (tresult != ISC_R_SUCCESS &&
(result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE))
{
result = tresult;
}
/* /*
* Lock hierarchy: zmgr, zone, raw. * Lock hierarchy: zmgr, zone, raw.
*/ */
@ -17250,9 +17243,13 @@ again:
goto again; goto again;
} }
} }
(void)zone_postload(zone, load->db, load->loadtime, result); tresult = zone_postload(zone, load->db, load->loadtime, result);
if (tresult != ISC_R_SUCCESS &&
(result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE))
{
result = tresult;
}
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADING); DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADING);
zone_idetach(&load->callbacks.zone);
/* /*
* Leave the zone frozen if the reload fails. * Leave the zone frozen if the reload fails.
*/ */
@ -17269,6 +17266,12 @@ again:
} }
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
(void)dns_db_endload(load->db, &load->callbacks);
LOCK_ZONE(zone);
zone_idetach(&load->callbacks.zone);
UNLOCK_ZONE(zone);
dns_db_detach(&load->db); dns_db_detach(&load->db);
if (zone->loadctx != NULL) { if (zone->loadctx != NULL) {
dns_loadctx_detach(&zone->loadctx); dns_loadctx_detach(&zone->loadctx);