Commit 2bb27e4a authored by Mark Andrews's avatar Mark Andrews

Merge branch...

Merge branch '2157-threadsanitizer-lock-order-inversion-potential-deadlock-in-pthread_rwlock_wrlock' into 'main'

Resolve "ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_wrlock"

Closes #2157

See merge request !4158
parents 52b0186b 10908766
Pipeline #52358 passed with stages
in 14 minutes and 9 seconds
......@@ -2534,6 +2534,7 @@ zone_gotwritehandle(isc_task_t *task, isc_event_t *event) {
isc_result_t result = ISC_R_SUCCESS;
dns_dbversion_t *version = NULL;
dns_masterrawheader_t rawdata;
dns_db_t *db = NULL;
REQUIRE(DNS_ZONE_VALID(zone));
INSIST(task == zone->task);
......@@ -2551,9 +2552,12 @@ zone_gotwritehandle(isc_task_t *task, isc_event_t *event) {
INSIST(zone != zone->raw);
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read);
if (zone->db != NULL) {
dns_db_attach(zone->db, &db);
}
ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
if (db != NULL) {
const dns_master_style_t *output_style;
dns_db_currentversion(zone->db, &version);
dns_db_currentversion(db, &version);
dns_master_initrawheader(&rawdata);
if (inline_secure(zone)) {
get_raw_serial(zone->raw, &rawdata);
......@@ -2566,14 +2570,16 @@ zone_gotwritehandle(isc_task_t *task, isc_event_t *event) {
output_style = &dns_master_style_default;
}
result = dns_master_dumpinc(
zone->mctx, zone->db, version, output_style,
zone->masterfile, zone->task, dump_done, zone,
&zone->dctx, zone->masterformat, &rawdata);
dns_db_closeversion(zone->db, &version, false);
zone->mctx, db, version, output_style, zone->masterfile,
zone->task, dump_done, zone, &zone->dctx,
zone->masterformat, &rawdata);
dns_db_closeversion(db, &version, false);
} else {
result = ISC_R_CANCELED;
}
ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
if (db != NULL) {
dns_db_detach(&db);
}
UNLOCK_ZONE(zone);
if (result != DNS_R_CONTINUE) {
goto fail;
......
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