]> git.ipfire.org Git - thirdparty/bind9.git/commit
Update STALE and ANCIENT header attributes atomically
authorOndřej Surý <ondrej@isc.org>
Thu, 25 Jun 2020 15:48:34 +0000 (17:48 +0200)
committerMark Andrews <marka@isc.org>
Wed, 8 Jul 2020 00:50:52 +0000 (10:50 +1000)
commit81d4230e60fc4c75077b7fe97f2dab9b9e9bb2a9
tree576d73dfff13019b21510e82e6cdfbcdbdeca5cc
parentef41dc097b91b933d810c327deddb0142173c1f3
Update STALE and ANCIENT header attributes atomically

The ThreadSanitizer found a data race when updating the stale header.
Instead of trying to acquire the write lock and failing occasionally
which would skew the statistics, the dns_rdatasetheader_t.attributes
field has been promoted to use stdatomics.  Updating the attributes in
the mark_header_ancient() and mark_header_stale() now uses the cmpxchg
to update the attributes forfeiting the need to hold the write lock on
the tree.  Please note that mark_header_ancient() still needs to hold
the lock because .dirty is being updated in the same go.
lib/dns/rbtdb.c