tdb2: allow multiple chain locks.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 27 Apr 2011 11:18:39 +0000 (20:48 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 27 Apr 2011 11:18:39 +0000 (20:48 +0930)
It's probably not a good idea, because it's a recipe for deadlocks if
anyone else grabs any *other* two chainlocks, or the allrecord lock,
but SAMBA definitely does it, so allow it as TDB1 does.

ccan/tdb2/lock.c

index 8a338cbe188c1f954ada8f701c2f7de6aeec5257..4033d0afe813e59bf4dee4b8bcc9e5d34757c298 100644 (file)
@@ -378,12 +378,14 @@ static enum TDB_ERROR tdb_nest_lock(struct tdb_context *tdb,
                return TDB_SUCCESS;
        }
 
+#if 0
        if (tdb->file->num_lockrecs
            && offset >= TDB_HASH_LOCK_START
            && offset < TDB_HASH_LOCK_START + TDB_HASH_LOCK_RANGE) {
                return tdb_logerr(tdb, TDB_ERR_LOCK, TDB_LOG_ERROR,
                                  "tdb_nest_lock: already have a hash lock?");
        }
+#endif
 
        new_lck = (struct tdb_lock *)realloc(
                tdb->file->lockrecs,