From ba5bb8eae6bcd230fd5321c618d6a9d56e74e7d1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 31 Aug 2011 15:31:08 +0930 Subject: [PATCH 1/1] tdb2: fix bogus error from tdb_unlockall() after fork in tdb1 backend. We're always allowed to unlock after a fork; by setting the count to 0 before calling the generic unlock function we don't trigger the pid check. --- ccan/tdb2/tdb1_lock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ccan/tdb2/tdb1_lock.c b/ccan/tdb2/tdb1_lock.c index e59874fb..5cc0ad65 100644 --- a/ccan/tdb2/tdb1_lock.c +++ b/ccan/tdb2/tdb1_lock.c @@ -384,15 +384,15 @@ int tdb1_allrecord_unlock(struct tdb_context *tdb, int ltype) return 0; } + tdb->file->allrecord_lock.count = 0; + tdb->file->allrecord_lock.ltype = 0; + if (tdb1_brunlock(tdb, ltype, TDB1_FREELIST_TOP, 0)) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_unlockall failed (%s)", strerror(errno)); return -1; } - tdb->file->allrecord_lock.count = 0; - tdb->file->allrecord_lock.ltype = 0; - return 0; } -- 2.39.2