summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-03-19 12:02:22 +0100
committerJeremy Allison <jra@samba.org>2014-05-22 21:05:15 +0200
commit41cf51b77459153d2bf5579025e42e221e179bc7 (patch)
treef6a77461a2ec1d0c15d763f93132434ea017c855 /source3
parent85fe2e8e3be15370f961561882518aedf137de5f (diff)
downloadsamba-41cf51b77459153d2bf5579025e42e221e179bc7.tar.gz
samba-41cf51b77459153d2bf5579025e42e221e179bc7.tar.xz
samba-41cf51b77459153d2bf5579025e42e221e179bc7.zip
dbwrap_tdb: Use mutexes on demand
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/dbwrap/dbwrap_open.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 81f20b048d5..64f484e70a5 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -93,6 +93,25 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
}
}
+ if (tdb_flags & TDB_CLEAR_IF_FIRST) {
+ const char *base;
+ bool try_mutex = false;
+
+ base = strrchr_m(name, '/');
+ if (base != NULL) {
+ base += 1;
+ } else {
+ base = name;
+ }
+
+ try_mutex = lp_parm_bool(-1, "dbwrap_tdb_mutexes", "*", try_mutex);
+ try_mutex = lp_parm_bool(-1, "dbwrap_tdb_mutexes", base, try_mutex);
+
+ if (try_mutex && tdb_runtime_check_for_robust_mutexes()) {
+ tdb_flags |= TDB_MUTEX_LOCKING;
+ }
+ }
+
sockname = lp_ctdbd_socket();
if (lp_clustering()) {