1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

tdb: fix locking error

54a51839ea "Make tdb transaction lock
recursive (samba version)" was broken: I "cleaned it up" and prevented
it from ever unlocking.

To see the problem:
	$ bin/tdbtorture -s 1248142523
	tdb_brlock failed (fd=3) at offset 8 rw_type=1 lck_type=14 len=1
	tdb_transaction_lock: failed to get transaction lock
	tdb_transaction_start failed: Resource deadlock avoided

My testcase relied on the *count* being correct, which it was.  Fixing that
now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Rusty Russell 2009-07-21 16:23:35 +09:30 committed by Michael Adam
parent 8e04c69e02
commit 760104188d

View File

@ -328,7 +328,7 @@ int tdb_transaction_unlock(struct tdb_context *tdb)
if (tdb->global_lock.count) {
return 0;
}
if (tdb->transaction_lock_count > 0) {
if (tdb->transaction_lock_count > 1) {
tdb->transaction_lock_count--;
return 0;
}