timerDB dump: bugfix: proper RCU lock for iterating zoneDB

This commit is contained in:
Libor Peltan 2025-12-27 20:36:07 +01:00
parent a59276c107
commit c5c40f3187
2 changed files with 3 additions and 4 deletions

View file

@ -12,6 +12,7 @@
#include <string.h>
#include <sys/types.h> // OpenBSD
#include <sys/resource.h>
#include <urcu.h>
#include "libknot/libknot.h"
#include "libknot/yparser/ypschema.h"
@ -977,7 +978,9 @@ static int timer_db_do_sync(struct dthread *thread)
server_t *s = thread->data;
while (thread->state & ThreadActive) {
rcu_read_lock();
int ret = zone_timers_write_all(&s->timerdb, s->zone_db);
rcu_read_unlock();
if (ret == KNOT_EOK) {
log_info("updated persistent timer DB");
} else {

View file

@ -8,8 +8,6 @@
#include "contrib/wire_ctx.h"
#include "knot/zone/zonedb.h"
#include <urcu.h>
/*
* # Timer database
*
@ -210,10 +208,8 @@ int zone_timers_write(knot_lmdb_db_t *db, const knot_dname_t *zone,
static void txn_zone_write(zone_t *z, knot_lmdb_txn_t *txn)
{
rcu_read_lock();
zone_timers_t *t = z->timers_static;
txn_write_timers(txn, z->name, t);
rcu_read_unlock();
}
int zone_timers_write_all(knot_lmdb_db_t *db, knot_zonedb_t *zonedb)