Commit 564427be authored by Rusty Russell's avatar Rusty Russell

tdb: use tdb_nest_lock() for seqnum lock.

This is pure overhead, but it centralizes the locking.  Realloc (esp. as
most implementations are lazy) is fast compared to the fnctl anyway.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent a879e3e2
......@@ -59,14 +59,14 @@ static void tdb_increment_seqnum(struct tdb_context *tdb)
return;
}
if (tdb_brlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1,
TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
if (tdb_nest_lock(tdb, TDB_SEQNUM_OFS, F_WRLCK,
TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
return;
}
tdb_increment_seqnum_nonblock(tdb);
tdb_brunlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1);
tdb_nest_unlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, false);
}
static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)
......
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