- return tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+ if (tdb->transaction_lock_count > 1) {
+ tdb->transaction_lock_count--;
+ return 0;
+ }
+ ret = tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+ if (ret == 0) {
+ tdb->transaction_lock_count = 0;
+ }
+ return ret;