Merge branch 'each-lmdb-lock-fix' into 'main'

ensure new_zone_lock is released after count_newzones()

See merge request isc-projects/bind9!3833
This commit is contained in:
Evan Hunt 2020-07-13 19:26:46 +00:00
commit e7602e2d51

View file

@ -7574,6 +7574,8 @@ count_newzones(dns_view_t *view, ns_cfgctx_t *nzcfg, int *num_zonesp) {
REQUIRE(num_zonesp != NULL);
LOCK(&view->new_zone_lock);
CHECK(migrate_nzf(view));
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@ -7582,8 +7584,6 @@ count_newzones(dns_view_t *view, ns_cfgctx_t *nzcfg, int *num_zonesp) {
"for view '%s'",
view->new_zone_db, view->name);
LOCK(&view->new_zone_lock);
CHECK(nzd_count(view, &n));
*num_zonesp = n;
@ -12911,6 +12911,10 @@ cleanup:
return (result);
}
/*
* Migrate zone configuration from an NZF file to an NZD database.
* Caller must hold view->new_zone_lock.
*/
static isc_result_t
migrate_nzf(dns_view_t *view) {
isc_result_t result;
@ -12926,8 +12930,6 @@ migrate_nzf(dns_view_t *view) {
MDB_val key, data;
ns_dzarg_t dzarg;
LOCK(&view->new_zone_lock);
/*
* If NZF file doesn't exist, or NZD DB exists and already
* has data, return without attempting migration.
@ -13063,8 +13065,6 @@ cleanup:
result = nzd_close(&txn, commit);
}
UNLOCK(&view->new_zone_lock);
if (text != NULL) {
isc_buffer_free(&text);
}