]> 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>
Thu, 6 Jan 2022 16:56:45 +0000 (17:56 +0100)
commit5be356760dd6855944234980f2fc0f13130267fb
tree631faf9d8817cfd8332108b201c8f3955fb2b142
parent9ec7d78d164991b668cd50371ffe8f9b7b4b5ac3
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.

(cherry picked from commit e705f213cac8a79e1fa8c20ce20f2e7a28daf3f9)
lib/isc/task.c