summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/common/traverse.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-30 08:15:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:53:06 -0500
commitdd64de3d5beeeca870a94f4fb8bbc4d094bbe989 (patch)
treeef67f20a1d4fe9c7f755e0993dfdfb705488cdbc /source4/lib/tdb/common/traverse.c
parent9c6c4848c941971f186a2cbcefcd07e5a1a55544 (diff)
downloadsamba-dd64de3d5beeeca870a94f4fb8bbc4d094bbe989.tar.gz
samba-dd64de3d5beeeca870a94f4fb8bbc4d094bbe989.tar.bz2
samba-dd64de3d5beeeca870a94f4fb8bbc4d094bbe989.zip
r23238: merged transaction lock changes from ctdb
this ensures that having the global lock also implies the transaction lock (This used to be commit 9dbb2633d7781fcc5d15b175ef36bfda5eb199bb)
Diffstat (limited to 'source4/lib/tdb/common/traverse.c')
-rw-r--r--source4/lib/tdb/common/traverse.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c
index fb2371d403..1baf90e0f5 100644
--- a/source4/lib/tdb/common/traverse.c
+++ b/source4/lib/tdb/common/traverse.c
@@ -205,12 +205,10 @@ int tdb_traverse_read(struct tdb_context *tdb,
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
int ret;
-
+
/* we need to get a read lock on the transaction lock here to
cope with the lock ordering semantics of solaris10 */
- if (tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_traverse_read: failed to get transaction lock\n"));
- tdb->ecode = TDB_ERR_LOCK;
+ if (tdb_transaction_lock(tdb, F_RDLCK)) {
return -1;
}
@@ -218,7 +216,7 @@ int tdb_traverse_read(struct tdb_context *tdb,
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
tdb->traverse_read--;
- tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+ tdb_transaction_unlock(tdb);
return ret;
}
@@ -237,15 +235,13 @@ int tdb_traverse(struct tdb_context *tdb,
return tdb_traverse_read(tdb, fn, private_data);
}
- if (tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_traverse: failed to get transaction lock\n"));
- tdb->ecode = TDB_ERR_LOCK;
+ if (tdb_transaction_lock(tdb, F_WRLCK)) {
return -1;
}
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
- tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+ tdb_transaction_unlock(tdb);
return ret;
}