Commit 30d253be authored by Rusty Russell's avatar Rusty Russell

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

Despite the name, they're simple byte locks, not whole-file.
parent be590188
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment