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

Merge branch '3137-create-new-log-messages-when-entering-and-exiting-exlusive-task-mode' into 'main'

Log when entering and exiting task exclusive mode

Closes #3137

See merge request isc-projects/bind9!5814
This commit is contained in:
Ondřej Surý 2022-02-10 20:21:18 +00:00
commit 62cf6a77cf
3 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,6 @@
5804. [func] Add a debug log message when starting and ending
the task exclusive mode. [GL #3137]
5803. [func] Use compile-time paths in the documentation.
[GL #2717]

View File

@ -41,6 +41,11 @@ Feature Changes
by a client are now included in the client information sent to DLZ
modules when processing queries. :gl:`#3082`
- Add DEBUG(1) level messages when starting and ending BIND 9 task exclusive mode
that stops the normal DNS operation (f.e. for reconfiguration, interface
scans, and other events that require exclusive access to a shared resources).
:gl:`#3137`
Bug Fixes
~~~~~~~~~

View File

@ -25,6 +25,7 @@
#include <isc/atomic.h>
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/once.h>
@ -1107,8 +1108,20 @@ isc_task_beginexclusive(isc_task_t *task) {
return (ISC_R_LOCKBUSY);
}
if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
"exclusive task mode: %s", "starting");
}
isc_nm_pause(manager->netmgr);
if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
"exclusive task mode: %s", "started");
}
return (ISC_R_SUCCESS);
}
@ -1120,7 +1133,20 @@ isc_task_endexclusive(isc_task_t *task) {
REQUIRE(task->state == task_state_running);
manager = task->manager;
if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
"exclusive task mode: %s", "ending");
}
isc_nm_resume(manager->netmgr);
if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
"exclusive task mode: %s", "ended");
}
REQUIRE(atomic_compare_exchange_strong(&manager->exclusive_req,
&(bool){ true }, false));
}