tdb: fix the unlock calls on the GLOBAL_LOCK from previous commit.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 19 Aug 2009 01:16:43 +0000 (10:46 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 19 Aug 2009 01:16:43 +0000 (10:46 +0930)
Despite the name, they're simple byte locks, not whole-file.

ccan/tdb/transaction.c

index c2e4748a8e7c668acb9c568660a59ab9c2f4cff6..988296372c578bde1f04311e7f25aa66caa1ea4b 100644 (file)
@@ -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;