mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Merge branch '3230-remove-task-exclusive-mode-from-ns_clientmgr' into 'main'
Remove task exclusive mode from ns_clientmgr Closes #3230 See merge request isc-projects/bind9!6024
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
||||
5842. [cleanup] Remove the task exclusive mode use in ns_clientmgr.
|
||||
[GL #3230]
|
||||
|
||||
5841. [bug] Refactor the address database:
|
||||
- Use self-resizing hash tables, eliminating the
|
||||
need to go into task-exclusive mode when resizing.
|
||||
|
@@ -2406,13 +2406,8 @@ clientmgr_destroy(ns_clientmgr_t *manager) {
|
||||
|
||||
dns_aclenv_detach(&manager->aclenv);
|
||||
|
||||
isc_mutex_destroy(&manager->lock);
|
||||
isc_mutex_destroy(&manager->reclock);
|
||||
|
||||
if (manager->excl != NULL) {
|
||||
isc_task_detach(&manager->excl);
|
||||
}
|
||||
|
||||
isc_task_detach(&manager->task);
|
||||
ns_server_detach(&manager->sctx);
|
||||
|
||||
@@ -2433,13 +2428,6 @@ ns_clientmgr_create(ns_server_t *sctx, isc_taskmgr_t *taskmgr,
|
||||
manager = isc_mem_get(mctx, sizeof(*manager));
|
||||
*manager = (ns_clientmgr_t){ .magic = 0, .mctx = mctx };
|
||||
|
||||
result = isc_taskmgr_excltask(taskmgr, &manager->excl);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_mutex_init(&manager->lock);
|
||||
isc_mutex_init(&manager->reclock);
|
||||
|
||||
manager->taskmgr = taskmgr;
|
||||
@@ -2448,7 +2436,6 @@ ns_clientmgr_create(ns_server_t *sctx, isc_taskmgr_t *taskmgr,
|
||||
|
||||
dns_aclenv_attach(aclenv, &manager->aclenv);
|
||||
|
||||
manager->exiting = false;
|
||||
result = isc_task_create_bound(manager->taskmgr, 20, &manager->task,
|
||||
manager->tid);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
@@ -2471,33 +2458,16 @@ ns_clientmgr_create(ns_server_t *sctx, isc_taskmgr_t *taskmgr,
|
||||
|
||||
void
|
||||
ns_clientmgr_destroy(ns_clientmgr_t **managerp) {
|
||||
isc_result_t result;
|
||||
ns_clientmgr_t *manager;
|
||||
bool unlock = false;
|
||||
|
||||
REQUIRE(managerp != NULL);
|
||||
REQUIRE(VALID_MANAGER(*managerp));
|
||||
|
||||
manager = *managerp;
|
||||
*managerp = NULL;
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
MTRACE("destroy");
|
||||
|
||||
/*
|
||||
* Check for success because we may already be task-exclusive
|
||||
* at this point. Only if we succeed at obtaining an exclusive
|
||||
* lock now will we need to relinquish it later.
|
||||
*/
|
||||
result = isc_task_beginexclusive(manager->excl);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
unlock = true;
|
||||
}
|
||||
|
||||
manager->exiting = true;
|
||||
|
||||
if (unlock) {
|
||||
isc_task_endexclusive(manager->excl);
|
||||
}
|
||||
|
||||
if (isc_refcount_decrement(&manager->references) == 1) {
|
||||
clientmgr_destroy(manager);
|
||||
}
|
||||
|
@@ -147,7 +147,6 @@ struct ns_clientmgr {
|
||||
ns_server_t *sctx;
|
||||
isc_taskmgr_t *taskmgr;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_task_t *excl;
|
||||
isc_refcount_t references;
|
||||
int tid;
|
||||
|
||||
@@ -156,10 +155,6 @@ struct ns_clientmgr {
|
||||
|
||||
dns_aclenv_t *aclenv;
|
||||
|
||||
/* Lock covers manager state. */
|
||||
isc_mutex_t lock;
|
||||
bool exiting;
|
||||
|
||||
/* Lock covers the recursing list */
|
||||
isc_mutex_t reclock;
|
||||
client_list_t recursing; /*%< Recursing clients */
|
||||
|
Reference in New Issue
Block a user