From 8beaee0b08c23677cd3ef88c90acc84dce5a0cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 24 Mar 2022 13:12:54 +0100 Subject: [PATCH 1/2] Remove task exclusive mode from ns_clientmgr The .lock, .exiting and .excl members were not using for anything else than starting task exclusive mode, setting .exiting to true and ending exclusive mode. Remove all the stray members and dead code eliminating the task exclusive mode use from ns_clientmgr. (cherry picked from commit 4f74e1010e041df492698c17fc66dc6c689442b5) --- lib/ns/client.c | 34 ++-------------------------------- lib/ns/include/ns/client.h | 5 ----- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/lib/ns/client.c b/lib/ns/client.c index d21e6be59c..42bfdfd8f1 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -2437,13 +2437,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); @@ -2464,13 +2459,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; @@ -2479,7 +2467,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); @@ -2502,33 +2489,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); } diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h index c5d8e86cf7..67d89a8922 100644 --- a/lib/ns/include/ns/client.h +++ b/lib/ns/include/ns/client.h @@ -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 */ From 4520ecc4711bd602938dd95dd08f48b1d5b36536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 24 Mar 2022 13:15:17 +0100 Subject: [PATCH 2/2] Add CHANGES mode for [GL #3230] (cherry picked from commit a24386056219500a967d959cbf4483151033ca5b) --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 7319bbc7ee..29506fb8aa 100644 --- a/CHANGES +++ b/CHANGES @@ -30,6 +30,9 @@ favor of rwlocked access to localhost and localnets members of dns_aclenv_t structure. [GL #3229] +5842. [cleanup] Remove the task exclusive mode use in ns_clientmgr. + [GL #3230] + --- 9.18.2 released --- 5856. [bug] The "starting maxtime timer" message related to outgoing