summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:40:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:40:13 +0930
commitb4a5c6dcb6c60a32b92772396dadfffa6b721732 (patch)
treeeb135a99d5966f7e03189d6764a9244ef0d54172 /lib
parent88ce92b92efe12f8a7364eb1786d73ec8ecd7884 (diff)
downloadsamba-b4a5c6dcb6c60a32b92772396dadfffa6b721732.tar.gz
samba-b4a5c6dcb6c60a32b92772396dadfffa6b721732.tar.xz
samba-b4a5c6dcb6c60a32b92772396dadfffa6b721732.zip
tdb2: don't cancel transactions on lock failures in tdb1 backend.
In TDB2, the user can override locking functions, so they may deliberarely fail (eg. be non-blocking) expecting to retry. For this reason, the TDB2 API requires the caller to cancel the transaction if tdb_transaction_prepare_commit() fails. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 8458811a4126c22635b974718bfbf2876c893c37)
Diffstat (limited to 'lib')
-rw-r--r--lib/tdb2/tdb1_transaction.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/tdb2/tdb1_transaction.c b/lib/tdb2/tdb1_transaction.c
index 9c526fb41e..f0623025f9 100644
--- a/lib/tdb2/tdb1_transaction.c
+++ b/lib/tdb2/tdb1_transaction.c
@@ -963,7 +963,6 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
"tdb1_transaction_prepare_commit:"
" failed to upgrade hash locks");
}
- _tdb1_transaction_cancel(tdb);
return -1;
}
@@ -975,7 +974,6 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
"tdb1_transaction_prepare_commit:"
" failed to get open lock");
}
- _tdb1_transaction_cancel(tdb);
return -1;
}
@@ -985,7 +983,6 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR,
"tdb1_transaction_prepare_commit:"
" failed to setup recovery data");
- _tdb1_transaction_cancel(tdb);
return -1;
}
}
@@ -1000,7 +997,6 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR,
"tdb1_transaction_prepare_commit:"
" expansion failed");
- _tdb1_transaction_cancel(tdb);
return -1;
}
tdb->file->map_size = tdb->transaction->old_map_size;
@@ -1080,8 +1076,10 @@ int tdb1_transaction_commit(struct tdb1_context *tdb)
if (!tdb->transaction->prepared) {
int ret = _tdb1_transaction_prepare_commit(tdb);
- if (ret)
+ if (ret) {
+ _tdb1_transaction_cancel(tdb);
return ret;
+ }
}
methods = tdb->transaction->io_methods;