summaryrefslogtreecommitdiff
path: root/source3/lib/tdb/common/transaction.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-06 22:57:35 -0800
committerJeremy Allison <jra@samba.org>2007-11-06 22:57:35 -0800
commit3809490dd0ceb902c002bfeff09e6c04946e1a0c (patch)
tree115bfa178b8e55bd7229316e22a3849fac519366 /source3/lib/tdb/common/transaction.c
parentd8f3c9d0786ff637241d2a9409e1c7c253715ba5 (diff)
downloadsamba-3809490dd0ceb902c002bfeff09e6c04946e1a0c.tar.gz
samba-3809490dd0ceb902c002bfeff09e6c04946e1a0c.tar.bz2
samba-3809490dd0ceb902c002bfeff09e6c04946e1a0c.zip
Keep the tdb code in sync with Samba4.
Mainly this is the svn changes : ------------------------------------------------------------------------ r23238 | tridge | 2007-05-30 01:15:49 -0700 (Wed, 30 May 2007) | 6 lines merged transaction lock changes from ctdb this ensures that having the global lock also implies the transaction lock ------------------------------------------------------------------------ r22832 | tridge | 2007-05-13 18:00:06 -0700 (Sun, 13 May 2007) | 3 lines merged the latest tdb changes from ctdb to Samba4 Jeremy. (This used to be commit ab11c0055761e97ba32a8c3ec4fa6f8763a262cd)
Diffstat (limited to 'source3/lib/tdb/common/transaction.c')
-rw-r--r--source3/lib/tdb/common/transaction.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c
index 8263bd7f38..7eaacf7a16 100644
--- a/source3/lib/tdb/common/transaction.c
+++ b/source3/lib/tdb/common/transaction.c
@@ -422,9 +422,7 @@ int tdb_transaction_start(struct tdb_context *tdb)
/* get the transaction write lock. This is a blocking lock. As
discussed with Volker, there are a number of ways we could
make this async, which we will probably do in the future */
- if (tdb_brlock(tdb, TRANSACTION_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: failed to get transaction lock\n"));
- tdb->ecode = TDB_ERR_LOCK;
+ if (tdb_transaction_lock(tdb, F_WRLCK) == -1) {
SAFE_FREE(tdb->transaction);
return -1;
}
@@ -468,6 +466,7 @@ int tdb_transaction_start(struct tdb_context *tdb)
TDB_HASHTABLE_SIZE(tdb)) != 0) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_start: failed to prime hash table\n"));
tdb->ecode = TDB_ERR_IO;
+ tdb->methods = tdb->transaction->io_methods;
goto fail;
}
@@ -475,7 +474,7 @@ int tdb_transaction_start(struct tdb_context *tdb)
fail:
tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
- tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+ tdb_transaction_unlock(tdb);
SAFE_FREE(tdb->transaction->hash_heads);
SAFE_FREE(tdb->transaction);
return -1;
@@ -530,7 +529,7 @@ int tdb_transaction_cancel(struct tdb_context *tdb)
tdb->methods = tdb->transaction->io_methods;
tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
- tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+ tdb_transaction_unlock(tdb);
SAFE_FREE(tdb->transaction->hash_heads);
SAFE_FREE(tdb->transaction);