From 964bdcd7add44e5bc87e1d44f2f4ece351b28eed Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 11 Jul 2013 10:51:19 -0700 Subject: [PATCH] [master] don't go nonresponsive during "rndc reload" 3617. [bug] Named was failing to answer queries during "rndc reload" [RT #34098] --- CHANGES | 3 +++ bin/named/server.c | 12 +++++++----- bin/tests/system/redirect/tests.sh | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index d586ef2593..d21d98c2dd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3617. [bug] Named was failing to answer queries during + "rndc reload" [RT #34098] + 3616. [bug] Change #3613 was incomplete. [RT #34177] 3615. [cleanup] "configure" now finishes by printing a summary diff --git a/bin/named/server.c b/bin/named/server.c index f0de910ed4..7e02fa5703 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -5929,7 +5929,7 @@ view_loaded(void *arg) { } static isc_result_t -load_zones(ns_server_t *server) { +load_zones(ns_server_t *server, isc_boolean_t init) { isc_result_t result; dns_view_t *view; ns_zoneload_t *zl; @@ -5980,12 +5980,14 @@ load_zones(ns_server_t *server) { if (refs == 0) { isc_refcount_destroy(&zl->refs); isc_mem_put(server->mctx, zl, sizeof (*zl)); - } else { + } 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. + * that are loading zones. (This should only be done during + * the initial server setup; it isn't necessary during + * a reload.) */ isc_taskmgr_setmode(ns_g_taskmgr, isc_taskmgrmode_privileged); } @@ -6077,7 +6079,7 @@ run_server(isc_task_t *task, isc_event_t *event) { isc_hash_init(); - CHECKFATAL(load_zones(server), "loading zones"); + CHECKFATAL(load_zones(server, ISC_TRUE), "loading zones"); } void @@ -6525,7 +6527,7 @@ reload(ns_server_t *server) { isc_result_t result; CHECK(loadconfig(server)); - result = load_zones(server); + result = load_zones(server, ISC_FALSE); if (result == ISC_R_SUCCESS) isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_INFO, diff --git a/bin/tests/system/redirect/tests.sh b/bin/tests/system/redirect/tests.sh index a51f58b341..7b83fecda8 100644 --- a/bin/tests/system/redirect/tests.sh +++ b/bin/tests/system/redirect/tests.sh @@ -338,12 +338,18 @@ sed -e 's/0 0 0 0 0/1 0 0 0 0/' < ns2/example.db.in > ns2/example.db sed -e 's/0 0 0 0 0/1 0 0 0 0/' -e 's/\.1$/.2/' < ns2/redirect.db.in > ns2/redirect.db $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload > rndc.out || ret=1 sed 's/^/I:ns2 /' rndc.out -$DIG $DIGOPTS +short @10.53.0.2 soa example.nil > dig.out.ns1.test$n || ret=1 -set -- `cat dig.out.ns1.test$n` -[ $3 = 1 ] || ret=1 -$DIG $DIGOPTS nonexist. @10.53.0.2 -b 10.53.0.2 a > dig.out.ns2.test$n || ret=1 -grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1 -grep "100.100.100.2" dig.out.ns2.test$n > /dev/null || ret=1 +for i in 1 2 3 4 5 6 7 8 9; do + tmp=0 + $DIG $DIGOPTS +short @10.53.0.2 soa example.nil > dig.out.ns1.test$n || tmp=1 + set -- `cat dig.out.ns1.test$n` + [ $3 = 1 ] || tmp=1 + $DIG $DIGOPTS nonexist. @10.53.0.2 -b 10.53.0.2 a > dig.out.ns2.test$n || tmp=1 + grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || tmp=1 + grep "100.100.100.2" dig.out.ns2.test$n > /dev/null || tmp=1 + [ $tmp -eq 0 ] && break + sleep 1 +done +[ $tmp -eq 1 ] && ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret`