mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Make dns_dt_reopen() request task-exclusive mode on its own
Instead of relying on the caller to set up task-exclusive mode, make dns_dt_reopen() enforce task-exclusive mode itself, using the task specified at dnstap environment creation time.
This commit is contained in:
parent
f199a5a9ae
commit
8e3c16175a
@ -3549,8 +3549,9 @@ configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) {
|
||||
fstrm_iothr_options_set_reopen_interval(fopt, i);
|
||||
}
|
||||
|
||||
CHECKM(dns_dt_create(named_g_mctx, dmode, dpath,
|
||||
&fopt, &named_g_server->dtenv),
|
||||
CHECKM(dns_dt_create2(named_g_mctx, dmode, dpath,
|
||||
&fopt, named_g_server->task,
|
||||
&named_g_server->dtenv),
|
||||
"unable to create dnstap environment");
|
||||
|
||||
CHECKM(dns_dt_setupfile(named_g_server->dtenv,
|
||||
@ -14825,10 +14826,7 @@ named_server_dnstap(named_server_t *server, isc_lex_t *lex,
|
||||
return (DNS_R_SYNTAX);
|
||||
}
|
||||
|
||||
result = isc_task_beginexclusive(server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
result = dns_dt_reopen(server->dtenv, backups);
|
||||
isc_task_endexclusive(server->task);
|
||||
return (result);
|
||||
#else
|
||||
UNUSED(server);
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include <isc/once.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/types.h>
|
||||
@ -331,11 +332,18 @@ dns_dt_reopen(dns_dtenv_t *env, int roll) {
|
||||
|
||||
REQUIRE(VALID_DTENV(env));
|
||||
|
||||
/*
|
||||
* Run in task-exclusive mode.
|
||||
*/
|
||||
result = isc_task_beginexclusive(env->reopen_task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
|
||||
/*
|
||||
* Check that we can create a new fw object.
|
||||
*/
|
||||
fwopt = fstrm_writer_options_init();
|
||||
if (fwopt == NULL) {
|
||||
isc_task_endexclusive(env->reopen_task);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
@ -424,6 +432,8 @@ dns_dt_reopen(dns_dtenv_t *env, int roll) {
|
||||
if (fuwopt != NULL)
|
||||
fstrm_unix_writer_options_destroy(&fuwopt);
|
||||
|
||||
isc_task_endexclusive(env->reopen_task);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,8 @@ dns_dt_reopen(dns_dtenv_t *env, int roll);
|
||||
* keep. If 'roll' is negative, or if 'env->mode' is dns_dtmode_unix,
|
||||
* then the channel is simply reopened.
|
||||
*
|
||||
* Note: dns_dt_reopen() must be called in task exclusive mode.
|
||||
* Note: dns_dt_reopen() uses task-exclusive mode and must be run in the
|
||||
* context of env->reopen_task.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'env' is a valid dnstap environment.
|
||||
|
Loading…
x
Reference in New Issue
Block a user