Commit cf648346 authored by Mark Andrews's avatar Mark Andrews

Merge branch '2180-threadsanitizer-data-race-bin-named-server-c-9678-25-in-view_loaded' into 'main'

Resolve "ThreadSanitizer: data race bin/named/server.c:9678:25 in view_loaded"

Closes #2180

See merge request isc-projects/bind9!4167
parents 6e6ad6d3 b00ba7ac
......@@ -82,7 +82,7 @@ struct named_server {
uint32_t interface_interval;
uint32_t heartbeat_interval;
named_reload_t reload_status;
atomic_int reload_status;
bool flushonshutdown;
......
......@@ -9676,7 +9676,7 @@ view_loaded(void *arg) {
"FIPS mode is %s",
FIPS_mode() ? "enabled" : "disabled");
#endif /* ifdef HAVE_FIPS_MODE */
server->reload_status = NAMED_RELOAD_DONE;
atomic_store(&server->reload_status, NAMED_RELOAD_DONE);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_NOTICE,
......@@ -10005,7 +10005,7 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
&server->in_roothints),
"setting up root hints");
server->reload_status = NAMED_RELOAD_IN_PROGRESS;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
/*
* Setup the server task, which is responsible for coordinating
......@@ -10318,7 +10318,7 @@ loadconfig(named_server_t *server) {
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"reloading configuration failed: %s",
isc_result_totext(result));
server->reload_status = NAMED_RELOAD_FAILED;
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
return (result);
......@@ -10327,7 +10327,9 @@ loadconfig(named_server_t *server) {
static isc_result_t
reload(named_server_t *server) {
isc_result_t result;
server->reload_status = NAMED_RELOAD_IN_PROGRESS;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
CHECK(loadconfig(server));
result = load_zones(server, false, false);
......@@ -10340,7 +10342,7 @@ reload(named_server_t *server) {
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"reloading zones failed: %s",
isc_result_totext(result));
server->reload_status = NAMED_RELOAD_FAILED;
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
cleanup:
return (result);
......@@ -10686,7 +10688,7 @@ named_server_reloadcommand(named_server_t *server, isc_lex_t *lex,
isc_result_t
named_server_reconfigcommand(named_server_t *server) {
isc_result_t result;
server->reload_status = NAMED_RELOAD_IN_PROGRESS;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
CHECK(loadconfig(server));
......@@ -10700,7 +10702,7 @@ named_server_reconfigcommand(named_server_t *server) {
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"loading new zones failed: %s",
isc_result_totext(result));
server->reload_status = NAMED_RELOAD_FAILED;
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
cleanup:
return (result);
......@@ -11808,6 +11810,7 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
char boottime[ISC_FORMATHTTPTIMESTAMP_SIZE];
char configtime[ISC_FORMATHTTPTIMESTAMP_SIZE];
char line[1024], hostname[256];
named_reload_t reload_status;
if (named_g_server->version_set) {
ob = " (";
......@@ -11910,9 +11913,10 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
ns_statscounter_tcphighwater));
CHECK(putstr(text, line));
if (server->reload_status != NAMED_RELOAD_DONE) {
reload_status = atomic_load(&server->reload_status);
if (reload_status != NAMED_RELOAD_DONE) {
snprintf(line, sizeof(line), "reload/reconfig %s\n",
(server->reload_status == NAMED_RELOAD_FAILED
(reload_status == NAMED_RELOAD_FAILED
? "failed"
: "in progress"));
CHECK(putstr(text, line));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment