summaryrefslogtreecommitdiff
path: root/lib/tdb/common
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-22 15:07:44 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-22 07:35:17 +0200
commit1783fe34433f9bb4b939de3231a7c296390ec426 (patch)
tree42d25680bc9c1e209a841b1a0d8fdc1d92297db4 /lib/tdb/common
parent945473aac0abffd8509bbeef3ed5a32737b7df51 (diff)
downloadsamba-1783fe34433f9bb4b939de3231a7c296390ec426.tar.gz
samba-1783fe34433f9bb4b939de3231a7c296390ec426.tar.bz2
samba-1783fe34433f9bb4b939de3231a7c296390ec426.zip
tdb: make TDB_NOSYNC merely disable sync.
(As suggested by Stefan Metzmacher, based on the change to ntdb.) Since commit ec96ea690edbe3398d690b4a953d487ca1773f1c, we handle the case where a process dies during a transaction commit. Unfortunately, TDB_NOSYNC means this no longer works, as it disables the recovery area as well as the actual msync/fsync. We should do everything except the syncs. This also means we can do a complete test with $TDB_NO_FSYNC set; just to get more complete coverage, we disable it explicitly for one test (where we override the actual sync calls anyway). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb/common')
-rw-r--r--lib/tdb/common/transaction.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index c3477eb80c..f18b4c229e 100644
--- a/lib/tdb/common/transaction.c
+++ b/lib/tdb/common/transaction.c
@@ -82,8 +82,9 @@
intervention.
- if TDB_NOSYNC is passed to flags in tdb_open then transactions are
- still available, but no transaction recovery area is used and no
- fsync/msync calls are made.
+ still available, but no fsync/msync calls are made. This means we
+ are still proof against a process dying during transaction commit,
+ but not against machine reboot.
- if TDB_ALLOW_NESTING is passed to flags in tdb open, or added using
tdb_add_flags() transaction nesting is enabled.
@@ -976,13 +977,11 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb)
return -1;
}
- if (!(tdb->flags & TDB_NOSYNC)) {
- /* write the recovery data to the end of the file */
- if (transaction_setup_recovery(tdb, &tdb->transaction->magic_offset) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: failed to setup recovery data\n"));
- _tdb_transaction_cancel(tdb);
- return -1;
- }
+ /* write the recovery data to the end of the file */
+ if (transaction_setup_recovery(tdb, &tdb->transaction->magic_offset) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: failed to setup recovery data\n"));
+ _tdb_transaction_cancel(tdb);
+ return -1;
}
tdb->transaction->prepared = true;