From 289d7d8fc5c2fcc004eeb0f0e4ce475c33e3952e Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Thu, 30 Mar 2017 12:03:17 +1300 Subject: [PATCH] ldb:tdb: Ensure we correctly decrement ltdb->read_lock_count If we do not do this, then we never take the all record lock, and instead do a lock for every record as we go, which is very slow during a large search Signed-off-by: Andrew Bartlett Signed-off-by: Garming Sam Reviewed-by: Stefan Metzmacher --- lib/ldb/ldb_tdb/ldb_tdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index f470e023d190..ad15a5e70a54 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -119,6 +119,7 @@ int ltdb_unlock_read(struct ldb_module *module) struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); if (ltdb->in_transaction == 0 && ltdb->read_lock_count == 1) { tdb_unlockall_read(ltdb->tdb); + ltdb->read_lock_count--; return 0; } ltdb->read_lock_count--; -- 2.34.1