From fba42f1fb4f81b8913cce5a23ca5350ba45f40e1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 17 Feb 2010 12:34:26 +1030 Subject: tdb: cleanup: tdb_have_extra_locks() helper In many places we check whether locks are held: add a helper to do this. The _tdb_lockall() case has already checked for the allrecord lock, so the extra work done by tdb_have_extra_locks() is merely redundant. Signed-off-by: Rusty Russell --- lib/tdb/common/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/tdb/common/open.c') diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c index 9fbd5fdea9..3fc9833863 100644 --- a/lib/tdb/common/open.c +++ b/lib/tdb/common/open.c @@ -465,7 +465,7 @@ static int tdb_reopen_internal(struct tdb_context *tdb, bool active_lock) return 0; /* Nothing to do. */ } - if (tdb->num_locks != 0 || tdb->allrecord_lock.count) { + if (tdb_have_extra_locks(tdb)) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_reopen: reopen not allowed with locks held\n")); goto fail; } -- cgit