summaryrefslogtreecommitdiff
path: root/source3/lib/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-20 14:18:58 -0700
committerJeremy Allison <jra@samba.org>2008-05-20 14:18:58 -0700
commit1a416ff13ca7786f2e8d24c66addf00883e9cb12 (patch)
treefee84b6441a2ba6af943410ecdb084ff0b2e8ef3 /source3/lib/tdb
parentc38a1e06b5ada7325ba0fcebd7254475ae84a4de (diff)
downloadsamba-1a416ff13ca7786f2e8d24c66addf00883e9cb12.tar.gz
samba-1a416ff13ca7786f2e8d24c66addf00883e9cb12.tar.bz2
samba-1a416ff13ca7786f2e8d24c66addf00883e9cb12.zip
Convert in_transaction to a bool. Add the same fix Volker
used for tdb_traverse() to tdb_traverse_read(). Jeremy. (This used to be commit bda0f03fb3fa8a7b14d4f54bee7076d691cad44f)
Diffstat (limited to 'source3/lib/tdb')
-rw-r--r--source3/lib/tdb/common/traverse.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/lib/tdb/common/traverse.c b/source3/lib/tdb/common/traverse.c
index 5a31742e7b..69c81e6e98 100644
--- a/source3/lib/tdb/common/traverse.c
+++ b/source3/lib/tdb/common/traverse.c
@@ -204,18 +204,23 @@ int tdb_traverse_read(struct tdb_context *tdb,
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
int ret;
+ bool in_transaction = (tdb->transaction != NULL);
/* we need to get a read lock on the transaction lock here to
cope with the lock ordering semantics of solaris10 */
- if (tdb_transaction_lock(tdb, F_RDLCK)) {
- return -1;
+ if (!in_transaction) {
+ if (tdb_transaction_lock(tdb, F_RDLCK)) {
+ return -1;
+ }
}
tdb->traverse_read++;
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
tdb->traverse_read--;
- tdb_transaction_unlock(tdb);
+ if (!in_transaction) {
+ tdb_transaction_unlock(tdb);
+ }
return ret;
}
@@ -232,7 +237,7 @@ int tdb_traverse(struct tdb_context *tdb,
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
int ret;
- int in_transaction = (tdb->transaction != NULL);
+ bool in_transaction = (tdb->transaction != NULL);
if (tdb->read_only || tdb->traverse_read) {
return tdb_traverse_read(tdb, fn, private_data);