From: Witold Kręcicki Date: Tue, 23 Oct 2018 09:39:56 +0000 (+0000) Subject: Comment about taskmgr exclusive mode, fix a REQUIRE. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32ca49c437290b3f10e124237158135740fa0683;p=thirdparty%2Fbind9.git Comment about taskmgr exclusive mode, fix a REQUIRE. --- diff --git a/lib/isc/task.c b/lib/isc/task.c index 2d01c9288cd..87ece27ec09 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -1015,6 +1015,16 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) { XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TASK, ISC_MSG_WORKING, "halting")); + /* + * Switching to exclusive mode is done as a 2-phase-lock, + * checking if we have to switch is done without any locks + * on pause_requested and exclusive_requested to save time - + * the worst thing that can happen is that we'll launch one task + * more and exclusive task will be postponed a bit. + * + * Broadcasting on halt_cond seems suboptimal, but exclusive tasks + * are rare enought that we don't care. + */ LOCK(&manager->halt_lock); manager->halted++; BROADCAST(&manager->halt_cond); @@ -1532,11 +1542,8 @@ isc_task_beginexclusive(isc_task_t *task0) { REQUIRE(VALID_TASK(task)); REQUIRE(task->state == task_state_running); - -/* - * TODO REQUIRE(task == task->manager->excl); - * it should be here, it fails on shutdown server->task - */ + REQUIRE(task == task->manager->excl || + (task->manager->exiting && task->manager->excl == NULL)); if (manager->exclusive_requested || manager->pause_requested) { return (ISC_R_LOCKBUSY);