]> git.ipfire.org Git - thirdparty/bind9.git/commit
Remove taskmgr->excl_lock, fix the locking for taskmgr->exiting
authorOndřej Surý <ondrej@isc.org>
Wed, 5 Jan 2022 12:06:37 +0000 (13:06 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 5 Jan 2022 15:44:57 +0000 (16:44 +0100)
commite705f213cac8a79e1fa8c20ce20f2e7a28daf3f9
treea24d8d043e0058bb1c32c7f8585a2267b180a787
parentf9d90159b84831fd83d74594827fedf0f4e9e265
Remove taskmgr->excl_lock, fix the locking for taskmgr->exiting

While doing code review, it was found that the taskmgr->exiting is set
under taskmgr->lock, but accessed under taskmgr->excl_lock in the
isc_task_beginexclusive().

Additionally, before the change that moved running the tasks to the
netmgr, the task_ready() subrouting of isc_task_detach() would lock
mgr->lock, requiring the mgr->excl to be protected mgr->excl_lock
to prevent deadlock in the code.  After !4918 has been merged, this is
no longer true, and we can remove taskmgr->excl_lock and use
taskmgr->lock in its stead.

Solve both issues by removing the taskmgr->excl_lock and exclusively use
taskmgr->lock to protect both taskmgr->excl and taskmgr->exiting which
now doesn't need to be atomic_bool, because it's always accessed from
within the locked section.
lib/isc/task.c