summaryrefslogtreecommitdiff
path: root/lib/tdb/common/traverse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tdb/common/traverse.c')
-rw-r--r--lib/tdb/common/traverse.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c
index 69c81e6e98..07b0c23858 100644
--- a/lib/tdb/common/traverse.c
+++ b/lib/tdb/common/traverse.c
@@ -204,23 +204,18 @@ 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 (!in_transaction) {
- if (tdb_transaction_lock(tdb, F_RDLCK)) {
- return -1;
- }
+ if (tdb_transaction_lock(tdb, F_RDLCK)) {
+ return -1;
}
tdb->traverse_read++;
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
tdb->traverse_read--;
- if (!in_transaction) {
- tdb_transaction_unlock(tdb);
- }
+ tdb_transaction_unlock(tdb);
return ret;
}
@@ -237,25 +232,20 @@ int tdb_traverse(struct tdb_context *tdb,
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
int ret;
- bool in_transaction = (tdb->transaction != NULL);
if (tdb->read_only || tdb->traverse_read) {
return tdb_traverse_read(tdb, fn, private_data);
}
- if (!in_transaction) {
- if (tdb_transaction_lock(tdb, F_WRLCK)) {
- return -1;
- }
+ if (tdb_transaction_lock(tdb, F_WRLCK)) {
+ return -1;
}
tdb->traverse_write++;
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
tdb->traverse_write--;
- if (!in_transaction) {
- tdb_transaction_unlock(tdb);
- }
+ tdb_transaction_unlock(tdb);
return ret;
}