[PATCH] tdb_wrap: Make mutexes easier to use

Christof Schmitt cs at samba.org
Wed Oct 1 15:35:42 MDT 2014


On Tue, Sep 30, 2014 at 01:10:17PM +0200, Volker Lendecke wrote:
> Hi!
> 
> What do you think about the attached (untested!) patch? I've
> just came across this because I wanted to invent a new tdb
> that is purely local and could benefit tremendously from
> mutexes (profile.tdb, holding source3/profile/profile.c
> data).
> 
> Comments appreciated!

No comments on the patch, but that would be also be useful to enable
mutexes in gencache. With my previous attempt to enable mutexes in the
gencache, i ran into the problem that dbwrap enforces the ctdb
transaction rules, even for local databases.

Christof
> 
> Thanks,
> 
> Volker
> 
> -- 
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de

> From fb00f6dd63bcd83247708fb2d88d505a2af2399b Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 30 Sep 2014 11:04:21 +0000
> Subject: [PATCH] tdb_wrap: Make mutexes easier to use
> 
> This patch makes sure we have the required INCOMPATIBLE_HASH flag if
> mutexes are requested and work fine and opens without mutexes if they
> are not supported
> ---
>  lib/tdb_wrap/tdb_wrap.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/lib/tdb_wrap/tdb_wrap.c b/lib/tdb_wrap/tdb_wrap.c
> index f2f32d1..2c5e517 100644
> --- a/lib/tdb_wrap/tdb_wrap.c
> +++ b/lib/tdb_wrap/tdb_wrap.c
> @@ -149,6 +149,15 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
>  	}
>  
>  	if (w == NULL) {
> +
> +		if (tdb_flags & TDB_MUTEX_LOCKING) {
> +			if (tdb_runtime_check_for_robust_mutexes()) {
> +				tdb_flags |= TDB_INCOMPATIBLE_HASH;
> +			} else {
> +				tdb_flags &= ~TDB_MUTEX_LOCKING;
> +			}
> +		}
> +
>  		w = tdb_wrap_private_open(result, name, hash_size, tdb_flags,
>  					  open_flags, mode);
>  	} else {
> -- 
> 1.7.9.5
> 



More information about the samba-technical mailing list