mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
Fixed multiple shutdown cleanup bugs in the zone object. This
involved extensive restructuring of the reference counting of zones and related objects. Zones now attach to their views. To avoid a circular dependency that would keep views from ever shutting down, this is done using the new functions dns_view_weakattach() / dns_view_weakdetach() which guarantee that the view will not be freed but still allow it to be shut down. The zones themselves now only have a single reference count, with similar "weak" semantics. Managed zones must now be shut down explicitly by calling dns_zone_shutdown(). To shut down all zones in a zone table, call dns_zt_shutdown(). The zone manager is now reference counted, weakly. To shut down the zone manager, you must explicitly call dns_zonemgr_shutdown().
This commit is contained in:
@@ -524,7 +524,8 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
|
||||
* there is no "version" configuration option.
|
||||
*/
|
||||
static isc_result_t
|
||||
create_version_view(dns_c_ctx_t *cctx, dns_view_t **viewp) {
|
||||
create_version_view(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr, dns_view_t **viewp)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_zone_t *zone = NULL;
|
||||
@@ -564,6 +565,7 @@ create_version_view(dns_c_ctx_t *cctx, dns_view_t **viewp) {
|
||||
|
||||
CHECK(dns_zone_create(&zone, ns_g_mctx));
|
||||
CHECK(dns_zone_setorigin(zone, &origin));
|
||||
CHECK(dns_zonemgr_managezone(zmgr, zone));
|
||||
|
||||
CHECK(dns_db_create(ns_g_mctx, "rbt", &origin, ISC_FALSE,
|
||||
dns_rdataclass_ch, 0, NULL, &db));
|
||||
@@ -1253,7 +1255,7 @@ load_configuration(const char *filename, ns_server_t *server,
|
||||
* Create (or recreate) the version view.
|
||||
*/
|
||||
view = NULL;
|
||||
CHECK(create_version_view(cctx, &view));
|
||||
CHECK(create_version_view(cctx, server->zonemgr, &view));
|
||||
ISC_LIST_APPEND(lctx.viewlist, view, link);
|
||||
view = NULL;
|
||||
|
||||
@@ -1447,9 +1449,12 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
|
||||
dns_dispatch_detach(&server->querysrc_dispatchv6);
|
||||
ns_clientmgr_destroy(&server->clientmgr);
|
||||
isc_timer_detach(&server->interface_timer);
|
||||
|
||||
ns_interfacemgr_shutdown(server->interfacemgr);
|
||||
ns_interfacemgr_detach(&server->interfacemgr);
|
||||
|
||||
dns_zonemgr_shutdown(server->zonemgr);
|
||||
dns_zonemgr_detach(&server->zonemgr);
|
||||
|
||||
isc_task_detach(&server->task);
|
||||
|
||||
@@ -1551,9 +1556,6 @@ ns_server_destroy(ns_server_t **serverp) {
|
||||
|
||||
INSIST(ISC_LIST_EMPTY(server->viewlist));
|
||||
|
||||
dns_zonemgr_destroy(&server->zonemgr);
|
||||
server->zonemgr = NULL;
|
||||
|
||||
dns_db_detach(&server->in_roothints);
|
||||
|
||||
dns_aclenv_destroy(&server->aclenv);
|
||||
|
Reference in New Issue
Block a user