summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/common/lock.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-01-15 14:05:47 +1100
committerAndrew Tridgell <tridge@samba.org>2008-01-15 14:05:47 +1100
commit9170998427ebbb7abfd9b482fb6e0d051bca5205 (patch)
tree52591d9535115e651b9db13328d32cef44c3b6e9 /source4/lib/tdb/common/lock.c
parentf233fd11b3afd49269d11653f3447129d97a7fff (diff)
downloadsamba-9170998427ebbb7abfd9b482fb6e0d051bca5205.tar.gz
samba-9170998427ebbb7abfd9b482fb6e0d051bca5205.tar.bz2
samba-9170998427ebbb7abfd9b482fb6e0d051bca5205.zip
merged tdb from ctdb bzr tree
(This used to be commit ed0c3a0f74c305b3b8554b05c3f97cf79db8296a)
Diffstat (limited to 'source4/lib/tdb/common/lock.c')
-rw-r--r--source4/lib/tdb/common/lock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/lib/tdb/common/lock.c b/source4/lib/tdb/common/lock.c
index e3fe888c46..f156c0fa7b 100644
--- a/source4/lib/tdb/common/lock.c
+++ b/source4/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)