]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Fix a race when accessing a backend health status
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 24 Jun 2024 11:19:01 +0000 (13:19 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 24 Jun 2024 11:23:04 +0000 (13:23 +0200)
commit8fdc60d882eadab43d51bcd4a20d5dadecf6f01c
tree176c0dba99301a7eb31e1b443d360382d00be975
parentc7670e3edb14a29fe6a720bf00cf958cb4fbf6eb
dnsdist: Fix a race when accessing a backend health status

While there should not be much risk in a data race involving a boolean
apart from getting an outdated value, it's still undefined behaviour
and it rightfully makes TSAN unhappy.
This commit makes the status atomic: hopefully using relaxed memory
ordering when reading the status will make it as cheap as a regular
non-atomic read on most platforms.
pdns/dnsdistdist/dnsdist-backend.cc
pdns/dnsdistdist/dnsdist-lua-bindings.cc
pdns/dnsdistdist/dnsdist-web.cc
pdns/dnsdistdist/dnsdist.hh