mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
redid configuration locking using isc_task_beginexclusive()
and isc_task_endexclusive() instead of a multitude of separate configuration rwlocks
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: client.c,v 1.150 2001/02/14 02:51:12 gson Exp $ */
|
||||
/* $Id: client.c,v 1.151 2001/02/14 03:50:04 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -1156,9 +1156,6 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
NS_CLIENTSTATE_READING :
|
||||
NS_CLIENTSTATE_READY);
|
||||
|
||||
RWLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
||||
dns_zonemgr_lockconf(ns_g_server->zonemgr, isc_rwlocktype_read);
|
||||
|
||||
if (event->ev_type == ISC_SOCKEVENT_RECVDONE) {
|
||||
INSIST(!TCP_CLIENT(client));
|
||||
sevent = (isc_socketevent_t *)event;
|
||||
@@ -1195,7 +1192,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
TCP_CLIENT(client) ? "TCP" : "UDP");
|
||||
|
||||
if (exit_check(client))
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
client->state = client->newstate = NS_CLIENTSTATE_WORKING;
|
||||
|
||||
isc_stdtime_get(&client->requesttime);
|
||||
@@ -1206,7 +1203,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
ns_client_next(client, result);
|
||||
else
|
||||
isc_task_shutdown(client->task);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((client->attributes & NS_CLIENTATTR_MULTICAST) != 0) {
|
||||
@@ -1221,7 +1218,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
result = dns_message_parse(client->message, buffer, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
ns_client_error(client, result);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1233,11 +1230,11 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
if (TCP_CLIENT(client)) {
|
||||
CTRACE("unexpected response");
|
||||
ns_client_next(client, DNS_R_FORMERR);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
} else {
|
||||
dns_dispatch_importrecv(client->dispatch, event);
|
||||
ns_client_next(client, ISC_R_SUCCESS);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1282,7 +1279,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
result = client_addopt(client);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
ns_client_error(client, result);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1293,7 +1290,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
version = (opt->ttl & 0x00FF0000) >> 16;
|
||||
if (version != 0) {
|
||||
ns_client_error(client, DNS_R_BADVERS);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1302,7 +1299,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
NS_LOGMODULE_CLIENT, ISC_LOG_ERROR,
|
||||
"message class could not be determined");
|
||||
ns_client_error(client, DNS_R_FORMERR);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1350,25 +1347,13 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
NS_LOGMODULE_CLIENT, ISC_LOG_ERROR,
|
||||
"no matching view in class '%s'", classname);
|
||||
ns_client_error(client, DNS_R_REFUSED);
|
||||
goto cleanup_serverlock;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ns_client_log(client, NS_LOGCATEGORY_CLIENT,
|
||||
NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(5),
|
||||
"using view '%s'", view->name);
|
||||
|
||||
/*
|
||||
* Lock the view's configuration data for reading.
|
||||
* We must attach a separate view reference for this
|
||||
* purpose instad of using client->view, because
|
||||
* client->view may or may not be detached at the point
|
||||
* when we return from this event handler depending
|
||||
* on whether the request handler causes ns_client_next()
|
||||
* to be called or not.
|
||||
*/
|
||||
dns_view_attach(client->view, &client->lockview);
|
||||
RWLOCK(&client->lockview->conflock, isc_rwlocktype_read);
|
||||
|
||||
/*
|
||||
* Check for a signature. We log bad signatures regardless of
|
||||
* whether they ultimately cause the request to be rejected or
|
||||
@@ -1400,7 +1385,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
if (!(client->message->tsigstatus == dns_tsigerror_badkey &&
|
||||
client->message->opcode == dns_opcode_update)) {
|
||||
ns_client_error(client, sigresult);
|
||||
goto cleanup_viewlock;
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
/* There is a signature, but it is bad. */
|
||||
@@ -1411,7 +1396,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
if (!(client->message->tsigstatus == dns_tsigerror_badkey &&
|
||||
client->message->opcode == dns_opcode_update)) {
|
||||
ns_client_error(client, sigresult);
|
||||
goto cleanup_viewlock;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1460,12 +1445,8 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
ns_client_error(client, DNS_R_NOTIMP);
|
||||
}
|
||||
|
||||
cleanup_viewlock:
|
||||
RWUNLOCK(&client->lockview->conflock, isc_rwlocktype_read);
|
||||
dns_view_detach(&client->lockview);
|
||||
cleanup_serverlock:
|
||||
dns_zonemgr_unlockconf(ns_g_server->zonemgr, isc_rwlocktype_read);
|
||||
RWUNLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
||||
cleanup:
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1577,7 +1558,6 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp)
|
||||
client->references = 0;
|
||||
client->attributes = 0;
|
||||
client->view = NULL;
|
||||
client->lockview = NULL;
|
||||
client->dispatch = NULL;
|
||||
client->udpsocket = NULL;
|
||||
client->tcplistener = NULL;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: client.h,v 1.52 2001/02/12 21:45:37 bwelling Exp $ */
|
||||
/* $Id: client.h,v 1.53 2001/02/14 03:50:07 gson Exp $ */
|
||||
|
||||
#ifndef NAMED_CLIENT_H
|
||||
#define NAMED_CLIENT_H 1
|
||||
@@ -98,7 +98,6 @@ struct ns_client {
|
||||
unsigned int attributes;
|
||||
isc_task_t * task;
|
||||
dns_view_t * view;
|
||||
dns_view_t * lockview;
|
||||
dns_dispatch_t * dispatch;
|
||||
isc_socket_t * udpsocket;
|
||||
isc_socket_t * tcplistener;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.h,v 1.51 2001/02/07 00:50:43 bwelling Exp $ */
|
||||
/* $Id: server.h,v 1.52 2001/02/14 03:50:08 gson Exp $ */
|
||||
|
||||
#ifndef NAMED_SERVER_H
|
||||
#define NAMED_SERVER_H 1
|
||||
@@ -41,16 +41,17 @@ struct ns_server {
|
||||
|
||||
isc_task_t * task;
|
||||
|
||||
/* Common rwlock for the server's configurable data. */
|
||||
isc_rwlock_t conflock;
|
||||
|
||||
/* Configurable data. */
|
||||
isc_quota_t xfroutquota;
|
||||
isc_quota_t tcpquota;
|
||||
isc_quota_t recursionquota;
|
||||
dns_acl_t *blackholeacl;
|
||||
|
||||
/* Not really configurable, but covered by conflock. */
|
||||
/*
|
||||
* Current ACL environment. This defines the
|
||||
* current values of the localhost and localnets
|
||||
* ACLs.
|
||||
*/
|
||||
dns_aclenv_t aclenv;
|
||||
|
||||
/* Server data structures. */
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: query.c,v 1.179 2001/02/14 03:01:12 bwelling Exp $ */
|
||||
/* $Id: query.c,v 1.180 2001/02/14 03:50:05 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -2036,19 +2036,7 @@ query_resume(isc_task_t *task, isc_event_t *event) {
|
||||
*/
|
||||
ns_client_detach(&client);
|
||||
} else {
|
||||
RWLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
||||
dns_zonemgr_lockconf(ns_g_server->zonemgr,
|
||||
isc_rwlocktype_read);
|
||||
dns_view_attach(client->view, &client->lockview);
|
||||
RWLOCK(&client->lockview->conflock, isc_rwlocktype_read);
|
||||
|
||||
query_find(client, devent, 0);
|
||||
|
||||
RWUNLOCK(&client->lockview->conflock, isc_rwlocktype_read);
|
||||
dns_view_detach(&client->lockview);
|
||||
dns_zonemgr_unlockconf(ns_g_server->zonemgr,
|
||||
isc_rwlocktype_read);
|
||||
RWUNLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.c,v 1.290 2001/02/08 18:01:33 halley Exp $ */
|
||||
/* $Id: server.c,v 1.291 2001/02/14 03:54:53 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -424,8 +424,6 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
|
||||
|
||||
cmctx = NULL;
|
||||
|
||||
RWLOCK(&view->conflock, isc_rwlocktype_write);
|
||||
|
||||
/*
|
||||
* Set the view's port number for outgoing queries.
|
||||
*/
|
||||
@@ -728,8 +726,6 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
RWUNLOCK(&view->conflock, isc_rwlocktype_write);
|
||||
|
||||
if (cmctx != NULL)
|
||||
isc_mem_detach(&cmctx);
|
||||
|
||||
@@ -1311,12 +1307,19 @@ scan_interfaces(ns_server_t *server, isc_boolean_t verbose) {
|
||||
*/
|
||||
static void
|
||||
interface_timer_tick(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
ns_server_t *server = (ns_server_t *) event->ev_arg;
|
||||
INSIST(task == server->task);
|
||||
UNUSED(task);
|
||||
isc_event_free(&event);
|
||||
RWLOCK(&server->conflock, isc_rwlocktype_write);
|
||||
/*
|
||||
* XXX should scan interfaces unlocked and get exclusive access
|
||||
* only to replace ACLs.
|
||||
*/
|
||||
result = isc_task_beginexclusive(server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
scan_interfaces(server, ISC_FALSE);
|
||||
RWUNLOCK(&server->conflock, isc_rwlocktype_write);
|
||||
isc_task_endexclusive(server->task);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1326,13 +1329,11 @@ heartbeat_timer_tick(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
UNUSED(task);
|
||||
isc_event_free(&event);
|
||||
RWLOCK(&server->conflock, isc_rwlocktype_read);
|
||||
view = ISC_LIST_HEAD(server->viewlist);
|
||||
while (view != NULL) {
|
||||
dns_view_dialup(view);
|
||||
view = ISC_LIST_NEXT(view, link);
|
||||
}
|
||||
RWUNLOCK(&server->conflock, isc_rwlocktype_read);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1426,8 +1427,9 @@ load_configuration(const char *filename, ns_server_t *server,
|
||||
|
||||
ns_aclconfctx_init(&aclconfctx);
|
||||
|
||||
RWLOCK(&server->conflock, isc_rwlocktype_write);
|
||||
dns_zonemgr_lockconf(server->zonemgr, isc_rwlocktype_write);
|
||||
/* Ensure exclusive access to configuration data. */
|
||||
result = isc_task_beginexclusive(server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
lctx.mctx = ns_g_mctx;
|
||||
lctx.aclconf = &aclconfctx;
|
||||
@@ -1856,8 +1858,8 @@ load_configuration(const char *filename, ns_server_t *server,
|
||||
if (dispatchv6 != NULL)
|
||||
dns_dispatch_detach(&dispatchv6);
|
||||
|
||||
dns_zonemgr_unlockconf(server->zonemgr, isc_rwlocktype_write);
|
||||
RWUNLOCK(&server->conflock, isc_rwlocktype_write);
|
||||
/* Relinquish exclusive access to configuration data. */
|
||||
isc_task_endexclusive(server->task);
|
||||
|
||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
|
||||
ISC_LOG_DEBUG(1), "load_configuration: %s",
|
||||
@@ -1871,7 +1873,8 @@ load_zones(ns_server_t *server, isc_boolean_t stop) {
|
||||
isc_result_t result;
|
||||
dns_view_t *view;
|
||||
|
||||
dns_zonemgr_lockconf(server->zonemgr, isc_rwlocktype_read);
|
||||
result = isc_task_beginexclusive(server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
/*
|
||||
* Load zone data from disk.
|
||||
@@ -1890,7 +1893,7 @@ load_zones(ns_server_t *server, isc_boolean_t stop) {
|
||||
*/
|
||||
CHECK(dns_zonemgr_forcemaint(server->zonemgr));
|
||||
cleanup:
|
||||
dns_zonemgr_unlockconf(server->zonemgr, isc_rwlocktype_read);
|
||||
isc_task_endexclusive(server->task);
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -1949,13 +1952,16 @@ ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush) {
|
||||
|
||||
static void
|
||||
shutdown_server(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
dns_view_t *view, *view_next;
|
||||
ns_server_t *server = (ns_server_t *)event->ev_arg;
|
||||
isc_boolean_t flush = server->flushonshutdown;
|
||||
|
||||
UNUSED(task);
|
||||
INSIST(task == server->task);
|
||||
|
||||
RWLOCK(&server->conflock, isc_rwlocktype_write);
|
||||
result = isc_task_beginexclusive(server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
|
||||
ISC_LOG_INFO, "shutting down%s",
|
||||
@@ -1985,11 +1991,11 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
|
||||
if (server->blackholeacl != NULL)
|
||||
dns_acl_detach(&server->blackholeacl);
|
||||
|
||||
isc_task_endexclusive(server->task);
|
||||
|
||||
isc_task_detach(&server->task);
|
||||
|
||||
isc_event_free(&event);
|
||||
|
||||
RWUNLOCK(&server->conflock, isc_rwlocktype_write);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2003,9 +2009,6 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
|
||||
server->mctx = mctx;
|
||||
server->task = NULL;
|
||||
|
||||
CHECKFATAL(isc_rwlock_init(&server->conflock, 1, 1),
|
||||
"initializing server configuration lock");
|
||||
|
||||
/* Initialize configuration data with default values. */
|
||||
|
||||
result = isc_quota_init(&server->xfroutquota, 10);
|
||||
@@ -2117,7 +2120,6 @@ ns_server_destroy(ns_server_t **serverp) {
|
||||
isc_quota_destroy(&server->recursionquota);
|
||||
isc_quota_destroy(&server->tcpquota);
|
||||
isc_quota_destroy(&server->xfroutquota);
|
||||
isc_rwlock_destroy(&server->conflock);
|
||||
|
||||
server->magic = 0;
|
||||
isc_mem_put(server->mctx, server, sizeof(*server));
|
||||
@@ -2137,6 +2139,8 @@ static void
|
||||
ns_server_reload(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
ns_server_t *server = (ns_server_t *)event->ev_arg;
|
||||
|
||||
INSIST(task = server->task);
|
||||
UNUSED(task);
|
||||
|
||||
if (ns_g_lwresdonly)
|
||||
@@ -2396,7 +2400,6 @@ ns_server_dumpstats(ns_server_t *server) {
|
||||
dns_statscounter_names[i],
|
||||
server->querystats[i]);
|
||||
|
||||
dns_zonemgr_lockconf(server->zonemgr, isc_rwlocktype_read);
|
||||
zone = NULL;
|
||||
for (result = dns_zone_first(server->zonemgr, &zone);
|
||||
result == ISC_R_SUCCESS;
|
||||
@@ -2429,7 +2432,6 @@ ns_server_dumpstats(ns_server_t *server) {
|
||||
CHECK(result);
|
||||
|
||||
fprintf(fp, "--- Statistics Dump --- (%lu)\n", (unsigned long)now);
|
||||
dns_zonemgr_unlockconf(server->zonemgr, isc_rwlocktype_read);
|
||||
|
||||
cleanup:
|
||||
if (fp != NULL)
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: view.h,v 1.66 2001/02/01 21:29:34 marka Exp $ */
|
||||
/* $Id: view.h,v 1.67 2001/02/14 03:50:13 gson Exp $ */
|
||||
|
||||
#ifndef DNS_VIEW_H
|
||||
#define DNS_VIEW_H 1
|
||||
@@ -90,13 +90,12 @@ struct dns_view {
|
||||
dns_keytable_t * secroots;
|
||||
dns_keytable_t * trustedkeys;
|
||||
isc_mutex_t lock;
|
||||
isc_rwlock_t conflock;
|
||||
isc_boolean_t frozen;
|
||||
isc_task_t * task;
|
||||
isc_event_t resevent;
|
||||
isc_event_t adbevent;
|
||||
isc_event_t reqevent;
|
||||
/* Configurable data, locked by conflock. */
|
||||
/* Configurable data. */
|
||||
dns_tsig_keyring_t * statickeys;
|
||||
dns_tsig_keyring_t * dynamickeys;
|
||||
dns_peerlist_t * peers;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.h,v 1.98 2001/01/18 23:29:31 gson Exp $ */
|
||||
/* $Id: zone.h,v 1.99 2001/02/14 03:50:14 gson Exp $ */
|
||||
|
||||
#ifndef DNS_ZONE_H
|
||||
#define DNS_ZONE_H 1
|
||||
@@ -1173,26 +1173,6 @@ dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
|
||||
* 'zone->zmgr' == NULL;
|
||||
*/
|
||||
|
||||
void
|
||||
dns_zonemgr_lockconf(dns_zonemgr_t *zmgr, isc_rwlocktype_t type);
|
||||
/*
|
||||
* Lock the zone manager lock.
|
||||
* 'type' specifies if this is a read or write lock.
|
||||
*
|
||||
* Requires:
|
||||
* 'zmgr' to be a valid zone manager.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_zonemgr_unlockconf(dns_zonemgr_t *zmgr, isc_rwlocktype_t type);
|
||||
/*
|
||||
* Unlock the zone manager lock. 'type' must be the same as the
|
||||
* preceeding call to dns_zonemgr_lockconf() for this 'zmgr'.
|
||||
*
|
||||
* Requires:
|
||||
* 'zmgr' to be a valid zone manager.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, int value);
|
||||
/*
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: view.c,v 1.95 2001/02/05 19:47:05 bwelling Exp $ */
|
||||
/* $Id: view.c,v 1.96 2001/02/14 03:50:10 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -79,14 +79,6 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto cleanup_name;
|
||||
}
|
||||
result = isc_rwlock_init(&view->conflock, 1, 1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_rwlock_init() failed: %s",
|
||||
isc_result_totext(result));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto cleanup_mutex;
|
||||
}
|
||||
view->zonetable = NULL;
|
||||
result = dns_zt_create(mctx, rdclass, &view->zonetable);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -94,7 +86,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
"dns_zt_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto cleanup_rwlock;
|
||||
goto cleanup_mutex;
|
||||
}
|
||||
view->secroots = NULL;
|
||||
result = dns_keytable_create(mctx, &view->secroots);
|
||||
@@ -198,9 +190,6 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
cleanup_zt:
|
||||
dns_zt_detach(&view->zonetable);
|
||||
|
||||
cleanup_rwlock:
|
||||
isc_rwlock_destroy(&view->conflock);
|
||||
|
||||
cleanup_mutex:
|
||||
DESTROYLOCK(&view->lock);
|
||||
|
||||
@@ -255,7 +244,6 @@ destroy(dns_view_t *view) {
|
||||
dns_keytable_detach(&view->trustedkeys);
|
||||
dns_keytable_detach(&view->secroots);
|
||||
dns_fwdtable_destroy(&view->fwdtable);
|
||||
isc_rwlock_destroy(&view->conflock);
|
||||
DESTROYLOCK(&view->lock);
|
||||
isc_refcount_destroy(&view->references);
|
||||
isc_mem_free(view->mctx, view->name);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.c,v 1.306 2001/02/12 03:03:40 marka Exp $ */
|
||||
/* $Id: zone.c,v 1.307 2001/02/14 03:50:11 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -265,7 +265,6 @@ struct dns_zonemgr {
|
||||
isc_task_t * task;
|
||||
isc_ratelimiter_t * rl;
|
||||
isc_rwlock_t rwlock;
|
||||
isc_rwlock_t conflock;
|
||||
isc_mutex_t iolock;
|
||||
|
||||
/* Locked by rwlock. */
|
||||
@@ -273,7 +272,7 @@ struct dns_zonemgr {
|
||||
dns_zonelist_t waiting_for_xfrin;
|
||||
dns_zonelist_t xfrin_in_progress;
|
||||
|
||||
/* Locked by conflock. */
|
||||
/* Configuration data. */
|
||||
int transfersin;
|
||||
int transfersperns;
|
||||
|
||||
@@ -3684,10 +3683,7 @@ zone_timer(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
ENTER;
|
||||
|
||||
dns_zonemgr_lockconf(zone->zmgr, isc_rwlocktype_read);
|
||||
/* XXX if we use a view, we need to lock its configuration, too. */
|
||||
zone_maintenance(zone);
|
||||
dns_zonemgr_unlockconf(zone->zmgr, isc_rwlocktype_read);
|
||||
|
||||
isc_event_free(&event);
|
||||
}
|
||||
@@ -5245,15 +5241,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto free_mem;
|
||||
}
|
||||
result = isc_rwlock_init(&zmgr->conflock, 1, 1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_rwlock_init() failed: %s",
|
||||
isc_result_totext(result));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto free_rwlock;
|
||||
}
|
||||
|
||||
zmgr->transfersin = 10;
|
||||
zmgr->transfersperns = 2;
|
||||
|
||||
@@ -5261,7 +5248,7 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
|
||||
result = isc_taskpool_create(taskmgr, mctx,
|
||||
8 /* XXX */, 0, &zmgr->zonetasks);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto free_conflock;
|
||||
goto free_rwlock;
|
||||
|
||||
/* Create a single task for queueing of SOA queries. */
|
||||
result = isc_task_create(taskmgr, 1, &zmgr->task);
|
||||
@@ -5305,8 +5292,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
|
||||
isc_task_detach(&zmgr->task);
|
||||
free_taskpool:
|
||||
isc_taskpool_destroy(&zmgr->zonetasks);
|
||||
free_conflock:
|
||||
isc_rwlock_destroy(&zmgr->conflock);
|
||||
free_rwlock:
|
||||
isc_rwlock_destroy(&zmgr->rwlock);
|
||||
free_mem:
|
||||
@@ -5469,27 +5454,12 @@ zonemgr_free(dns_zonemgr_t *zmgr) {
|
||||
DESTROYLOCK(&zmgr->iolock);
|
||||
isc_ratelimiter_detach(&zmgr->rl);
|
||||
|
||||
isc_rwlock_destroy(&zmgr->conflock);
|
||||
isc_rwlock_destroy(&zmgr->rwlock);
|
||||
mctx = zmgr->mctx;
|
||||
isc_mem_put(zmgr->mctx, zmgr, sizeof *zmgr);
|
||||
isc_mem_detach(&mctx);
|
||||
}
|
||||
|
||||
void
|
||||
dns_zonemgr_lockconf(dns_zonemgr_t *zmgr, isc_rwlocktype_t type) {
|
||||
REQUIRE(DNS_ZONEMGR_VALID(zmgr));
|
||||
|
||||
RWLOCK(&zmgr->conflock, type);
|
||||
}
|
||||
|
||||
void
|
||||
dns_zonemgr_unlockconf(dns_zonemgr_t *zmgr, isc_rwlocktype_t type) {
|
||||
REQUIRE(DNS_ZONEMGR_VALID(zmgr));
|
||||
|
||||
RWUNLOCK(&zmgr->conflock, type);
|
||||
}
|
||||
|
||||
void
|
||||
dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, int value) {
|
||||
REQUIRE(DNS_ZONEMGR_VALID(zmgr));
|
||||
|
Reference in New Issue
Block a user