From 4a4da8faaf8ad31360ee8f07ef97dfdf6a5554a3 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 7 Oct 2011 04:41:30 +0000 Subject: [PATCH] 3157. [tuning] Reduce the time spent in "rndc reconfig" by parsing the config file before pausing the server. [RT #21373] --- CHANGES | 3 +++ bin/named/server.c | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 2c797fac68a..9bb3daa70d0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3157. [tuning] Reduce the time spent in "rndc reconfig" by parsing + the config file before pausing the server. [RT #21373] + 3156. [bug] Reconfiguring the server with an incorrectly formatted TSIG key could cause a crash during subsequent zone transfers. [RT #20391] diff --git a/bin/named/server.c b/bin/named/server.c index 6683a1ee371..8c7a86246c2 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.520.12.28 2011/09/23 00:37:28 each Exp $ */ +/* $Id: server.c,v 1.520.12.29 2011/10/07 04:41:30 each Exp $ */ /*! \file */ @@ -3022,14 +3022,11 @@ load_configuration(const char *filename, ns_server_t *server, isc_uint32_t udpsize; unsigned int maxsocks; int num_zones = 0; + isc_boolean_t exclusive = ISC_FALSE; cfg_aclconfctx_init(&aclconfctx); ISC_LIST_INIT(viewlist); - /* Ensure exclusive access to configuration data. */ - result = isc_task_beginexclusive(server->task); - RUNTIME_CHECK(result == ISC_R_SUCCESS); - /* * Parse the global default pseudo-config file. */ @@ -3096,6 +3093,13 @@ load_configuration(const char *filename, ns_server_t *server, maps[i++] = ns_g_defaults; maps[i] = NULL; + /* Ensure exclusive access to configuration data. */ + if (!exclusive) { + result = isc_task_beginexclusive(server->task); + RUNTIME_CHECK(result == ISC_R_SUCCESS); + exclusive = ISC_TRUE; + } + /* * Set process limits, which (usually) needs to be done as root. */ @@ -3807,7 +3811,8 @@ load_configuration(const char *filename, ns_server_t *server, adjust_interfaces(server, ns_g_mctx); /* Relinquish exclusive access to configuration data. */ - isc_task_endexclusive(server->task); + if (exclusive) + isc_task_endexclusive(server->task); isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_DEBUG(1), "load_configuration: %s", -- 2.47.3