2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 16:45:24 +00:00

2979. [bug] named could deadlock during shutdown if two

"rndc stop" commands were issued at the same
			time. [RT #22108]
This commit is contained in:
Evan Hunt
2010-12-03 22:05:19 +00:00
parent 310e10d536
commit e78c2b856b
7 changed files with 47 additions and 6 deletions

View File

@@ -1,3 +1,7 @@
2979. [bug] named could deadlock during shutdown if two
"rndc stop" commands were issued at the same
time. [RT #22108]
2978. [port] hpux: look for <devpoll.h> [RT #21919] 2978. [port] hpux: look for <devpoll.h> [RT #21919]
2977. [bug] 'nsupdate -l' report if the session key is missing. 2977. [bug] 'nsupdate -l' report if the session key is missing.

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: control.c,v 1.40 2010/08/16 22:21:06 marka Exp $ */ /* $Id: control.c,v 1.41 2010/12/03 22:05:19 each Exp $ */
/*! \file */ /*! \file */
@@ -129,11 +129,16 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) {
* isc_app_shutdown below. * isc_app_shutdown below.
*/ */
#endif #endif
/* Do not flush master files */
ns_server_flushonshutdown(ns_g_server, ISC_FALSE); ns_server_flushonshutdown(ns_g_server, ISC_FALSE);
ns_os_shutdownmsg(command, text); ns_os_shutdownmsg(command, text);
isc_app_shutdown(); isc_app_shutdown();
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;
} else if (command_compare(command, NS_COMMAND_STOP)) { } else if (command_compare(command, NS_COMMAND_STOP)) {
/*
* "stop" is the same as "halt" except it does
* flush master files.
*/
#ifdef HAVE_LIBSCF #ifdef HAVE_LIBSCF
if (ns_smf_got_instance == 1 && ns_smf_chroot == 1) { if (ns_smf_got_instance == 1 && ns_smf_chroot == 1) {
result = ns_smf_add_message(text); result = ns_smf_add_message(text);

View File

@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: namespace.h,v 1.7 2010/08/13 23:47:03 tbox Exp $ */ /* $Id: namespace.h,v 1.8 2010/12/03 22:05:19 each Exp $ */
#ifndef ISCAPI_NAMESPACE_H #ifndef ISCAPI_NAMESPACE_H
#define ISCAPI_NAMESPACE_H 1 #define ISCAPI_NAMESPACE_H 1
@@ -129,6 +129,7 @@
#define isc_task_create isc__task_create #define isc_task_create isc__task_create
#define isc_task_attach isc__task_attach #define isc_task_attach isc__task_attach
#define isc_task_detach isc__task_detach #define isc_task_detach isc__task_detach
#define isc_task_exiting isc__task_exiting
#define isc_task_send isc__task_send #define isc_task_send isc__task_send
#define isc_task_sendanddetach isc__task_sendanddetach #define isc_task_sendanddetach isc__task_sendanddetach
#define isc_task_purgerange isc__task_purgerange #define isc_task_purgerange isc__task_purgerange

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: task.h,v 1.65 2009/09/02 18:38:40 jinmei Exp $ */ /* $Id: task.h,v 1.66 2010/12/03 22:05:19 each Exp $ */
#ifndef ISC_TASK_H #ifndef ISC_TASK_H
#define ISC_TASK_H 1 #define ISC_TASK_H 1
@@ -599,6 +599,16 @@ isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t);
*\li '*t' has the "current time". *\li '*t' has the "current time".
*/ */
isc_boolean_t
isc__task_exiting(isc_task_t *t);
/*%<
* Returns ISC_TRUE if the task is in the process of shutting down,
* ISC_FALSE otherwise.
*
* Requires:
*\li 'task' is a valid task.
*/
/***** /*****
***** Task Manager. ***** Task Manager.
*****/ *****/

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: task.c,v 1.111 2009/10/05 17:30:49 fdupont Exp $ */ /* $Id: task.c,v 1.112 2010/12/03 22:05:19 each Exp $ */
/*! \file /*! \file
* \author Principal Author: Bob Halley * \author Principal Author: Bob Halley
@@ -1482,6 +1482,15 @@ isc__task_register() {
} }
#endif #endif
isc_boolean_t
isc__task_exiting(isc_task_t *t) {
isc__task_t *task = (isc__task_t *)t;
REQUIRE(VALID_TASK(task));
return (TASK_SHUTTINGDOWN(task));
}
#if defined(HAVE_LIBXML2) && defined(BIND9) #if defined(HAVE_LIBXML2) && defined(BIND9)
void void
isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, xmlTextWriterPtr writer) { isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, xmlTextWriterPtr writer) {

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: socket.c,v 1.331 2010/12/03 00:54:39 marka Exp $ */ /* $Id: socket.c,v 1.332 2010/12/03 22:05:19 each Exp $ */
/*! \file */ /*! \file */
@@ -5115,6 +5115,12 @@ isc__socket_accept(isc_socket_t *sock0,
* Attach to socket and to task. * Attach to socket and to task.
*/ */
isc_task_attach(task, &ntask); isc_task_attach(task, &ntask);
if (isc_task_exiting(ntask)) {
isc_task_detach(&ntask);
isc_event_free(ISC_EVENT_PTR(&dev));
UNLOCK(&sock->lock);
return (ISC_R_SHUTTINGDOWN);
}
nsock->references++; nsock->references++;
nsock->statsindex = sock->statsindex; nsock->statsindex = sock->statsindex;

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: socket.c,v 1.85 2010/11/18 00:59:43 tbox Exp $ */ /* $Id: socket.c,v 1.86 2010/12/03 22:05:19 each Exp $ */
/* This code uses functions which are only available on Server 2003 and /* This code uses functions which are only available on Server 2003 and
* higher, and Windows XP and higher. * higher, and Windows XP and higher.
@@ -3313,6 +3313,12 @@ isc__socket_accept(isc_socket_t *sock,
* Attach to socket and to task. * Attach to socket and to task.
*/ */
isc_task_attach(task, &ntask); isc_task_attach(task, &ntask);
if (isc_task_exiting(ntask)) {
isc_task_detach(&ntask);
isc_event_free(ISC_EVENT_PTR(&dev));
UNLOCK(&sock->lock);
return (ISC_R_SHUTTINGDOWN);
}
nsock->references++; nsock->references++;
adev->ev_sender = ntask; adev->ev_sender = ntask;