Commit 9e5f417f authored by Ondřej Surý's avatar Ondřej Surý
Browse files

Refactor taskmgr to run on top of netmgr

This commit changes the taskmgr to run the individual tasks on the
netmgr internal workers.  While an effort has been put into keeping
the taskmgr interface intact, couple of changes have been made:

 * The taskmgr has no concept of universal privileged mode - rather the
   tasks are either privileged or unprivileged (normal).  The privileged
   tasks are run as a first thing when the netmgr is unpaused.  There are
   now four different queues in in the netmgr:

   1. priority queue - netievent on the priority queue are run even when
      the taskmgr enter exclusive mode and netmgr is paused.  This is
      needed to properly start listening on the interfaces, free
      resources and resume.

   2. privileged task queue - only privileged tasks are queued here and
      this is the first queue that gets processed when network manager
      is unpaused using isc_nm_resume().  All netmgr workers need to
      clean the privileged task queue before they all proceed normal
      operation.  Both task queues are processed when the workers are
      finished.

   3. task queue - only (traditional) task are scheduled here and this
      queue along with privileged task queues are process when the
      netmgr workers are finishing.  This is needed to process the task
      shutdown events.

   4. normal queue - this is the queue with netmgr events, e.g. reading,
      sending, callbacks and pretty much everything is processed here.

 * The isc_taskmgr_create() now requires initialized netmgr (isc_nm_t)
   object.

 * The isc_nm_destroy() function now waits for indefinite time, but it
   will print out the active objects when in tracing mode
   (-DNETMGR_TRACE=1 and -DNETMGR_TRACE_VERBOSE=1), the netmgr has been
   made a little bit more asynchronous and it might take longer time to
   shutdown all the active networking connections.

 * Previously, the isc_nm_stoplistening() was a synchronous operation.
   This has been changed and the isc_nm_stoplistening() just schedules
   the child sockets to stop listening and exits.  This was needed to
   prevent a deadlock as the the (traditional) tasks are now executed on
   the netmgr threads.

 * The socket selection logic in isc__nm_udp_send() was flawed, but
   fortunatelly, it was broken, so we never hit the problem where we
   created uvreq_t on a socket from nmhandle_t, but then a different
   socket could be picked up and then we were trying to run the send
   callback on a socket that had different threadid than currently
   running.
parent 5635dca1
Pipeline #69224 failed with stages
in 33 minutes and 38 seconds
......@@ -36,6 +36,7 @@
#include <isc/log.h>
#include <isc/md.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#ifdef WIN32
#include <isc/ntpaths.h>
#endif /* ifdef WIN32 */
......@@ -1736,6 +1737,7 @@ main(int argc, char *argv[]) {
dns_namelist_t namelist;
unsigned int resopt;
isc_appctx_t *actx = NULL;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_socketmgr_t *socketmgr = NULL;
isc_timermgr_t *timermgr = NULL;
......@@ -1759,7 +1761,8 @@ main(int argc, char *argv[]) {
isc_mem_create(&mctx);
CHECK(isc_appctx_create(mctx, &actx));
CHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr));
netmgr = isc_nm_start(mctx, 1);
CHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
CHECK(isc_socketmgr_create(mctx, &socketmgr));
CHECK(isc_timermgr_create(mctx, &timermgr));
......@@ -1867,6 +1870,9 @@ cleanup:
if (taskmgr != NULL) {
isc_taskmgr_destroy(&taskmgr);
}
if (netmgr != NULL) {
isc_nm_destroy(&netmgr);
}
if (timermgr != NULL) {
isc_timermgr_destroy(&timermgr);
}
......
......@@ -1362,7 +1362,7 @@ setup_libs(void) {
netmgr = isc_nm_start(mctx, 1);
result = isc_taskmgr_create(mctx, 1, 0, netmgr, &taskmgr);
result = isc_taskmgr_create(mctx, 0, netmgr, &taskmgr);
check_result(result, "isc_taskmgr_create");
result = isc_task_create(taskmgr, 0, &global_task);
......
......@@ -144,6 +144,7 @@ static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
static const char *directory = NULL, *dsdir = NULL;
static isc_mutex_t namelock, statslock;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */
......@@ -3953,7 +3954,9 @@ main(int argc, char *argv[]) {
print_time(outfp);
print_version(outfp);
result = isc_taskmgr_create(mctx, ntasks, 0, NULL, &taskmgr);
netmgr = isc_nm_start(mctx, ntasks);
result = isc_taskmgr_create(mctx, 0, netmgr, &taskmgr);
if (result != ISC_R_SUCCESS) {
fatal("failed to create task manager: %s",
isc_result_totext(result));
......@@ -4009,6 +4012,7 @@ main(int argc, char *argv[]) {
isc_task_detach(&tasks[i]);
}
isc_taskmgr_destroy(&taskmgr);
isc_nm_destroy(&netmgr);
isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
postsign();
TIME_NOW(&sign_finish);
......
......@@ -960,7 +960,7 @@ create_managers(void) {
return (ISC_R_UNEXPECTED);
}
result = isc_taskmgr_create(named_g_mctx, named_g_cpus, 0, named_g_nm,
result = isc_taskmgr_create(named_g_mctx, 0, named_g_nm,
&named_g_taskmgr);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
......@@ -1011,13 +1011,9 @@ destroy_managers(void) {
* isc_taskmgr_destroy() will block until all tasks have exited.
*/
isc_taskmgr_destroy(&named_g_taskmgr);
isc_nm_destroy(&named_g_nm);
isc_timermgr_destroy(&named_g_timermgr);
isc_socketmgr_destroy(&named_g_socketmgr);
/*
* At this point is safe to destroy the netmgr.
*/
isc_nm_destroy(&named_g_nm);
}
static void
......
......@@ -9866,7 +9866,7 @@ view_loaded(void *arg) {
}
static isc_result_t
load_zones(named_server_t *server, bool init, bool reconfig) {
load_zones(named_server_t *server, bool reconfig) {
isc_result_t result;
dns_view_t *view;
ns_zoneload_t *zl;
......@@ -9921,16 +9921,6 @@ cleanup:
if (isc_refcount_decrement(&zl->refs) == 1) {
isc_refcount_destroy(&zl->refs);
isc_mem_put(server->mctx, zl, sizeof(*zl));
} else if (init) {
/*
* Place the task manager into privileged mode. This
* ensures that after we leave task-exclusive mode, no
* other tasks will be able to run except for the ones
* that are loading zones. (This should only be done during
* the initial server setup; it isn't necessary during
* a reload.)
*/
isc_taskmgr_setprivilegedmode(named_g_taskmgr);
}
isc_task_endexclusive(server->task);
......@@ -9998,7 +9988,7 @@ run_server(isc_task_t *task, isc_event_t *event) {
CHECKFATAL(load_configuration(named_g_conffile, server, true),
"loading configuration");
CHECKFATAL(load_zones(server, true, false), "loading zones");
CHECKFATAL(load_zones(server, false), "loading zones");
#ifdef ENABLE_AFL
named_g_run_done = true;
#endif /* ifdef ENABLE_AFL */
......@@ -10511,7 +10501,7 @@ reload(named_server_t *server) {
CHECK(loadconfig(server));
result = load_zones(server, false, false);
result = load_zones(server, false);
if (result == ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
......@@ -10880,7 +10870,7 @@ named_server_reconfigcommand(named_server_t *server) {
CHECK(loadconfig(server));
result = load_zones(server, false, true);
result = load_zones(server, true);
if (result == ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
......
......@@ -125,6 +125,7 @@ static bool usegsstsig = false;
static bool use_win2k_gsstsig = false;
static bool tried_other_gsstsig = false;
static bool local_only = false;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static isc_task_t *global_task = NULL;
static isc_event_t *global_event = NULL;
......@@ -927,7 +928,9 @@ setup_system(void) {
result = isc_timermgr_create(gmctx, &timermgr);
check_result(result, "dns_timermgr_create");
result = isc_taskmgr_create(gmctx, 1, 0, NULL, &taskmgr);
netmgr = isc_nm_start(gmctx, 1);
result = isc_taskmgr_create(gmctx, 0, netmgr, &taskmgr);
check_result(result, "isc_taskmgr_create");
result = isc_task_create(taskmgr, 0, &global_task);
......@@ -3311,6 +3314,9 @@ cleanup(void) {
ddebug("Shutting down task manager");
isc_taskmgr_destroy(&taskmgr);
ddebug("Shutting down network manager");
isc_nm_destroy(&netmgr);
ddebug("Destroying event");
isc_event_free(&global_event);
......
......@@ -1032,7 +1032,7 @@ main(int argc, char **argv) {
isc_mem_create(&rndc_mctx);
netmgr = isc_nm_start(rndc_mctx, 1);
DO("create task manager",
isc_taskmgr_create(rndc_mctx, 1, 0, netmgr, &taskmgr));
isc_taskmgr_create(rndc_mctx, 0, netmgr, &taskmgr));
DO("create task", isc_task_create(taskmgr, 0, &rndc_task));
isc_log_create(rndc_mctx, &log, &logconfig);
isc_log_setcontext(log);
......
......@@ -13,6 +13,7 @@ named.run
parallel.mk
/*.log
/*.trs
/resolve
/run.sh
/run.log
/start.sh
......
......@@ -206,7 +206,8 @@ main(int argc, char *argv[]) {
isc_result_t result;
isc_log_t *lctx;
isc_logconfig_t *lcfg;
isc_taskmgr_t *taskmgr;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_task_t *task;
isc_timermgr_t *timermgr;
isc_socketmgr_t *socketmgr;
......@@ -276,8 +277,9 @@ main(int argc, char *argv[]) {
RUNCHECK(dst_lib_init(mctx, NULL));
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr));
netmgr = isc_nm_start(mctx, 1);
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
task = NULL;
RUNCHECK(isc_task_create(taskmgr, 0, &task));
timermgr = NULL;
......@@ -322,6 +324,7 @@ main(int argc, char *argv[]) {
isc_task_shutdown(task);
isc_task_detach(&task);
isc_taskmgr_destroy(&taskmgr);
isc_nm_destroy(&netmgr);
dst_lib_destroy();
......
......@@ -53,6 +53,85 @@
#include <irs/resconf.h>
/*
* Global contexts
*/
isc_mem_t *ctxs_mctx = NULL;
isc_appctx_t *ctxs_actx = NULL;
isc_nm_t *ctxs_netmgr = NULL;
isc_taskmgr_t *ctxs_taskmgr = NULL;
isc_socketmgr_t *ctxs_socketmgr = NULL;
isc_timermgr_t *ctxs_timermgr = NULL;
static void
ctxs_destroy(void) {
if (ctxs_netmgr != NULL) {
isc_nm_closedown(ctxs_netmgr);
}
if (ctxs_taskmgr != NULL) {
isc_taskmgr_destroy(&ctxs_taskmgr);
}
if (ctxs_netmgr != NULL) {
isc_nm_destroy(&ctxs_netmgr);
}
if (ctxs_timermgr != NULL) {
isc_timermgr_destroy(&ctxs_timermgr);
}
if (ctxs_socketmgr != NULL) {
isc_socketmgr_destroy(&ctxs_socketmgr);
}
if (ctxs_actx != NULL) {
isc_appctx_destroy(&ctxs_actx);
}
if (ctxs_mctx != NULL) {
isc_mem_destroy(&ctxs_mctx);
}
}
static isc_result_t
ctxs_init(void) {
isc_result_t result;
isc_mem_create(&ctxs_mctx);
result = isc_appctx_create(ctxs_mctx, &ctxs_actx);
if (result != ISC_R_SUCCESS) {
goto fail;
}
ctxs_netmgr = isc_nm_start(ctxs_mctx, 1);
result = isc_taskmgr_create(ctxs_mctx, 0, ctxs_netmgr,
&ctxs_taskmgr);
if (result != ISC_R_SUCCESS) {
goto fail;
}
result = isc_socketmgr_create(ctxs_mctx, &ctxs_socketmgr);
if (result != ISC_R_SUCCESS) {
goto fail;
}
result = isc_timermgr_create(ctxs_mctx, &ctxs_timermgr);
if (result != ISC_R_SUCCESS) {
goto fail;
}
return (ISC_R_SUCCESS);
fail:
ctxs_destroy();
return (result);
}
static char *algname;
static isc_result_t
......@@ -93,8 +172,7 @@ usage(void) {
}
static void
set_key(dns_client_t *client, char *keynamestr, char *keystr, bool is_sep,
isc_mem_t **mctxp) {
set_key(dns_client_t *client, char *keynamestr, char *keystr, bool is_sep) {
isc_result_t result;
dns_fixedname_t fkeyname;
unsigned int namelen;
......@@ -109,8 +187,6 @@ set_key(dns_client_t *client, char *keynamestr, char *keystr, bool is_sep,
isc_region_t r;
dns_secalg_t alg;
isc_mem_create(mctxp);
if (algname != NULL) {
tr.base = algname;
tr.length = strlen(algname);
......@@ -176,7 +252,6 @@ addserver(dns_client_t *client, const char *addrstr, const char *port,
isc_sockaddr_t sa;
isc_sockaddrlist_t servers;
isc_result_t result;
unsigned int namelen;
isc_buffer_t b;
dns_fixedname_t fname;
dns_name_t *name = NULL;
......@@ -201,7 +276,7 @@ addserver(dns_client_t *client, const char *addrstr, const char *port,
ISC_LIST_APPEND(servers, &sa, link);
if (name_space != NULL) {
namelen = strlen(name_space);
unsigned int namelen = strlen(name_space);
isc_buffer_constinit(&b, name_space, namelen);
isc_buffer_add(&b, namelen);
name = dns_fixedname_initname(&fname);
......@@ -240,15 +315,9 @@ main(int argc, char *argv[]) {
dns_rdatatype_t type = dns_rdatatype_a;
dns_rdataset_t *rdataset;
dns_namelist_t namelist;
isc_mem_t *keymctx = NULL;
unsigned int clientopt, resopt = 0;
bool is_sep = false;
const char *port = "53";
isc_mem_t *mctx = NULL;
isc_appctx_t *actx = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_socketmgr_t *socketmgr = NULL;
isc_timermgr_t *timermgr = NULL;
struct in_addr in4;
struct in6_addr in6;
isc_sockaddr_t a4, a6;
......@@ -361,32 +430,15 @@ main(int argc, char *argv[]) {
exit(1);
}
isc_mem_create(&mctx);
result = isc_appctx_create(mctx, &actx);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
result = isc_app_ctxstart(actx);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
result = isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
result = isc_socketmgr_create(mctx, &socketmgr);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
result = isc_timermgr_create(mctx, &timermgr);
result = ctxs_init();
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
clientopt = 0;
result = dns_client_create(mctx, actx, taskmgr, socketmgr, timermgr,
clientopt, &client, addr4, addr6);
result = dns_client_create(ctxs_mctx, ctxs_actx, ctxs_taskmgr,
ctxs_socketmgr, ctxs_timermgr, clientopt,
&client, addr4, addr6);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "dns_client_create failed: %u, %s\n", result,
isc_result_totext(result));
......@@ -398,7 +450,8 @@ main(int argc, char *argv[]) {
irs_resconf_t *resconf = NULL;
isc_sockaddrlist_t *nameservers;
result = irs_resconf_load(mctx, "/etc/resolv.conf", &resconf);
result = irs_resconf_load(ctxs_mctx, "/etc/resolv.conf",
&resconf);
if (result != ISC_R_SUCCESS && result != ISC_R_FILENOTFOUND) {
fprintf(stderr, "irs_resconf_load failed: %u\n",
result);
......@@ -430,7 +483,7 @@ main(int argc, char *argv[]) {
"while key name is provided\n");
exit(1);
}
set_key(client, keynamestr, keystr, is_sep, &keymctx);
set_key(client, keynamestr, keystr, is_sep);
}
/* Construct qname */
......@@ -470,25 +523,11 @@ main(int argc, char *argv[]) {
/* Cleanup */
cleanup:
dns_client_destroy(&client);
if (taskmgr != NULL) {
isc_taskmgr_destroy(&taskmgr);
}
if (timermgr != NULL) {
isc_timermgr_destroy(&timermgr);
}
if (socketmgr != NULL) {
isc_socketmgr_destroy(&socketmgr);
if (client != NULL) {
dns_client_destroy(&client);
}
if (actx != NULL) {
isc_appctx_destroy(&actx);
}
isc_mem_detach(&mctx);
if (keynamestr != NULL) {
isc_mem_destroy(&keymctx);
}
ctxs_destroy();
dns_lib_shutdown();
return (0);
......
......@@ -192,7 +192,8 @@ sendquery(isc_task_t *task, isc_event_t *event) {
int
main(int argc, char *argv[]) {
char *ourkeyname;
isc_taskmgr_t *taskmgr;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_timermgr_t *timermgr;
isc_socketmgr_t *socketmgr;
isc_socket_t *sock;
......@@ -234,8 +235,9 @@ main(int argc, char *argv[]) {
RUNCHECK(dst_lib_init(mctx, NULL));
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr));
netmgr = isc_nm_start(mctx, 1);
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
task = NULL;
RUNCHECK(isc_task_create(taskmgr, 0, &task));
timermgr = NULL;
......@@ -292,6 +294,7 @@ main(int argc, char *argv[]) {
isc_task_shutdown(task);
isc_task_detach(&task);
isc_taskmgr_destroy(&taskmgr);
isc_nm_destroy(&netmgr);
isc_socket_detach(&sock);
isc_socketmgr_destroy(&socketmgr);
isc_timermgr_destroy(&timermgr);
......
......@@ -17,6 +17,7 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/sockaddr.h>
......@@ -135,7 +136,8 @@ sendquery(isc_task_t *task, isc_event_t *event) {
int
main(int argc, char **argv) {
char *keyname;
isc_taskmgr_t *taskmgr;
isc_nm_t *netmgr;
isc_taskmgr_t *taskmgr = NULL;
isc_timermgr_t *timermgr;
isc_socketmgr_t *socketmgr;
isc_socket_t *sock;
......@@ -177,8 +179,9 @@ main(int argc, char **argv) {
RUNCHECK(dst_lib_init(mctx, NULL));
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr));
netmgr = isc_nm_start(mctx, 1);
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
task = NULL;
RUNCHECK(isc_task_create(taskmgr, 0, &task));
timermgr = NULL;
......@@ -235,6 +238,7 @@ main(int argc, char **argv) {
isc_task_shutdown(task);
isc_task_detach(&task);
isc_taskmgr_destroy(&taskmgr);
isc_nm_destroy(&netmgr);
isc_socket_detach(&sock);
isc_socketmgr_destroy(&socketmgr);
isc_timermgr_destroy(&timermgr);
......
......@@ -2083,7 +2083,8 @@ main(int argc, char *argv[]) {
isc_sockaddr_t bind_any;
isc_log_t *lctx;
isc_logconfig_t *lcfg;
isc_taskmgr_t *taskmgr;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_task_t *task;
isc_timermgr_t *timermgr;
isc_socketmgr_t *socketmgr;
......@@ -2144,8 +2145,9 @@ main(int argc, char *argv[]) {
fatal("can't choose between IPv4 and IPv6");
}
taskmgr = NULL;
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr));
netmgr = isc_nm_start(mctx, 1);
RUNCHECK(isc_taskmgr_create(mctx, 0, netmgr, &taskmgr));
task = NULL;
RUNCHECK(isc_task_create(taskmgr, 0, &task));
timermgr = NULL;
......@@ -2225,6 +2227,7 @@ main(int argc, char *argv[]) {
isc_task_shutdown(task);
isc_task_detach(&task);
isc_taskmgr_destroy(&taskmgr);
isc_nm_destroy(&netmgr);
dst_lib_destroy();
......
......@@ -63,6 +63,7 @@
isc_mem_t *dt_mctx = NULL;
isc_log_t *lctx = NULL;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_task_t *maintask = NULL;
isc_timermgr_t *timermgr = NULL;
......@@ -100,6 +101,9 @@ cleanup_managers(void) {
if (taskmgr != NULL) {
isc_taskmgr_destroy(&taskmgr);
}
if (netmgr != NULL) {
isc_nm_destroy(&netmgr);
}
if (timermgr != NULL) {
isc_timermgr_destroy(&timermgr);
}
......@@ -113,7 +117,8 @@ create_managers(void) {
isc_result_t result;
ncpus = isc_os_ncpus();
CHECK(isc_taskmgr_create(dt_mctx, ncpus, 0, NULL, &taskmgr));
netmgr = isc_nm_start(dt_mctx, ncpus);
CHECK(isc_taskmgr_create(dt_mctx, 0, netmgr, &taskmgr));
CHECK(isc_timermgr_create(dt_mctx, &timermgr));
CHECK(isc_socketmgr_create(dt_mctx, &socketmgr));
CHECK(isc_task_create(taskmgr, 0, &maintask));
......
......@@ -18385,42 +18385,35 @@ dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones) {
/* Create or resize the zone task pools. */
if (zmgr->zonetasks == NULL) {
result = isc_taskpool_create(zmgr->taskmgr, zmgr->mctx, ntasks,
2, &pool);
2, false, &pool);
} else {
result = isc_taskpool_expand(&zmgr->zonetasks, ntasks, &pool);
result = isc_taskpool_expand(&zmgr->zonetasks, ntasks, false,
&pool);
}
 
if (result == ISC_R_SUCCESS) {
zmgr->zonetasks = pool;
}
 
/*
* We always set all tasks in the zone-load task pool to
* privileged. This prevents other tasks in the system from
* running while the server task manager is in privileged
* mode.
*/
pool = NULL;
if (zmgr->loadtasks == NULL) {
result = isc_taskpool_create(zmgr->taskmgr, zmgr->mctx, ntasks,
2, &pool);
2, true, &pool);
} else {
result = isc_taskpool_expand(&zmgr->loadtasks, ntasks, &pool);
result = isc_taskpool_expand(&zmgr->loadtasks, ntasks, true,
&pool);
}
 
if (result == ISC_R_SUCCESS) {
zmgr->loadtasks = pool;
}
 
/*
* We always set all tasks in the zone-load task pool to
* privileged. This prevents other tasks in the system from
* running while the server task manager is in privileged
* mode.
*
* NOTE: If we start using task privileges for any other
* part of the system than zone tasks, then this will need to be
* revisted. In that case we'd want to turn on privileges for
* zone tasks only when we were loading, and turn them off the
* rest of the time. For now, however, it's okay to just
* set it and forget it.
*/