From: Rusty Russell Date: Wed, 19 Aug 2009 01:16:43 +0000 (+0930) Subject: tdb: fix the unlock calls on the GLOBAL_LOCK from previous commit. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=30d253bec03079999a63672477d83fbb8c4520cc tdb: fix the unlock calls on the GLOBAL_LOCK from previous commit. Despite the name, they're simple byte locks, not whole-file. --- diff --git a/ccan/tdb/transaction.c b/ccan/tdb/transaction.c index c2e4748a..98829637 100644 --- a/ccan/tdb/transaction.c +++ b/ccan/tdb/transaction.c @@ -969,7 +969,7 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb) /* write the recovery data to the end of the file */ if (transaction_setup_recovery(tdb, &tdb->transaction->magic_offset) == -1) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: failed to setup recovery data\n")); - tdb_brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 0); + tdb_brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 1); _tdb_transaction_cancel(tdb, F_WRLCK); return -1; } @@ -984,7 +984,7 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb) tdb->transaction->old_map_size) == -1) { tdb->ecode = TDB_ERR_IO; TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: expansion failed\n")); - tdb_brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 0); + tdb_brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 1); _tdb_transaction_cancel(tdb, F_WRLCK); return -1; } @@ -1080,7 +1080,7 @@ int tdb_transaction_commit(struct tdb_context *tdb) tdb_transaction_recover(tdb); _tdb_transaction_cancel(tdb, F_WRLCK); - tdb_brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 0); + tdb_brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 1); TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed\n")); return -1;