summaryrefslogtreecommitdiff
path: root/source3/lib/tdb/common/lock.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-11 15:08:37 -0800
committerJeremy Allison <jra@samba.org>2008-01-11 15:08:37 -0800
commit2ec41571a3efbea254cc3e132280a194c86a2f89 (patch)
treecc324e5f6cabfb4e017dfe021afd95cdd2738995 /source3/lib/tdb/common/lock.c
parent9cd74303478ac15b4357fb7f76d9576fe9a060a1 (diff)
downloadsamba-2ec41571a3efbea254cc3e132280a194c86a2f89.tar.gz
samba-2ec41571a3efbea254cc3e132280a194c86a2f89.tar.bz2
samba-2ec41571a3efbea254cc3e132280a194c86a2f89.zip
Sync tdb with the tdb changes in ctdb. Spoke to tridge about
this. Fixes insidious problem with order n^2 freelist merging. Jeremy. (This used to be commit c6609c042b128e7d63eb64cfdfb0f6b65cb59d76)
Diffstat (limited to 'source3/lib/tdb/common/lock.c')
-rw-r--r--source3/lib/tdb/common/lock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/lib/tdb/common/lock.c b/source3/lib/tdb/common/lock.c
index e3fe888c46..f156c0fa7b 100644
--- a/source3/lib/tdb/common/lock.c
+++ b/source3/lib/tdb/common/lock.c
@@ -505,6 +505,9 @@ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key)
/* record lock stops delete underneath */
int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off)
{
+ if (tdb->global_lock.count) {
+ return 0;
+ }
return off ? tdb->methods->tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0, 1) : 0;
}
@@ -537,6 +540,10 @@ int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off)
struct tdb_traverse_lock *i;
uint32_t count = 0;
+ if (tdb->global_lock.count) {
+ return 0;
+ }
+
if (off == 0)
return 0;
for (i = &tdb->travlocks; i; i = i->next)