From 41cf51b77459153d2bf5579025e42e221e179bc7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 19 Mar 2013 12:02:22 +0100 Subject: [PATCH] dbwrap_tdb: Use mutexes on demand Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Volker Lendecke Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam Reviewed-by: Jeremy Allison --- source3/lib/dbwrap/dbwrap_open.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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()) { -- 2.34.1