Commit 4fd7cf1d authored by Rusty Russell's avatar Rusty Russell

Handle global_lock properly in tdb_transaction_lock/unlock.

parent 83a1386b
...@@ -301,7 +301,10 @@ int tdb_unlock(struct tdb_context *tdb, int list, int ltype) ...@@ -301,7 +301,10 @@ int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
*/ */
int tdb_transaction_lock(struct tdb_context *tdb, int ltype) int tdb_transaction_lock(struct tdb_context *tdb, int ltype)
{ {
if (tdb->have_transaction_lock || tdb->global_lock.count) { if (tdb->global_lock.count) {
return 0;
}
if (tdb->have_transaction_lock) {
tdb->have_transaction_lock++; tdb->have_transaction_lock++;
return 0; return 0;
} }
...@@ -320,6 +323,9 @@ int tdb_transaction_lock(struct tdb_context *tdb, int ltype) ...@@ -320,6 +323,9 @@ int tdb_transaction_lock(struct tdb_context *tdb, int ltype)
*/ */
int tdb_transaction_unlock(struct tdb_context *tdb) int tdb_transaction_unlock(struct tdb_context *tdb)
{ {
if (tdb->global_lock.count) {
return 0;
}
if (--tdb->have_transaction_lock) { if (--tdb->have_transaction_lock) {
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment