]> git.ipfire.org Git - thirdparty/bind9.git/commit
Remove isc_rwlock_downgrade usage in rbtdb.c
authorOndřej Surý <ondrej@isc.org>
Thu, 13 Oct 2022 19:10:04 +0000 (21:10 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 2 Nov 2022 07:45:48 +0000 (08:45 +0100)
commit006a7f0cb647b12362f8d3dd891ee7eabbeeea23
treedc928bfa32fc3d57f9a6f1dd5ddd5caeef5dccbf
parent395a5576b40eb7f4d34ee0606200947b4698173e
Remove isc_rwlock_downgrade usage in rbtdb.c

The only place where isc_rwlock_downgrade was being used was the
decrement_reference() where the code tries either relocks the node
rwlock to write and then tries to upgrade the tree lock.  When returning
from the function it tries to restore the locks into a previous state
which is nice, but kind of moot, because at every use of
decrement_reference() the node locks is immediately or almost
immeditately unlocked, and same holds for the tree lock.

Instead of trying to restore the node and tree lock into the initial
state, the decrement_reference now returns the state of the locks, so
the caller can then use the right unlock operation (read or write).
Only when the tree lock was originally unlocked, the decrement_reference
unlocks the tree lock before returning to the caller.
lib/dns/rbtdb.c