X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Flock.c;h=bcd560d792231ff2defce3430cf6feb7117fa243;hp=117596a3f203814daa9e4611d96b1216de050643;hb=7ff5fdae5859fc5e7bbe2fa1aad3b8eee73b4891;hpb=83a1386b50966eb9667478c7cef9154dbd622541 diff --git a/ccan/tdb/lock.c b/ccan/tdb/lock.c index 117596a3..bcd560d7 100644 --- a/ccan/tdb/lock.c +++ b/ccan/tdb/lock.c @@ -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) { - 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++; return 0; } @@ -320,6 +323,9 @@ int tdb_transaction_lock(struct tdb_context *tdb, int ltype) */ int tdb_transaction_unlock(struct tdb_context *tdb) { + if (tdb->global_lock.count) { + return 0; + } if (--tdb->have_transaction_lock) { return 0; }