Browse Source

tdb: fix the unlock calls on the GLOBAL_LOCK from previous commit.

Despite the name, they're simple byte locks, not whole-file.
Rusty Russell 16 years ago
parent
commit
30d253bec0
1 changed files with 3 additions and 3 deletions
  1. 3 3
      ccan/tdb/transaction.c

+ 3 - 3
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;