[PATCH] tdb_wrap: Make mutexes easier to use

Stefan (metze) Metzmacher metze at samba.org
Tue Sep 30 05:21:39 MDT 2014


Hi Volker,

> 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!

tdb_open_ex() has

        if (tdb_flags & TDB_MUTEX_LOCKING) {
                tdb_flags |= TDB_INCOMPATIBLE_HASH;
        }

so the tdb_flags |= TDB_INCOMPATIBLE_HASH; in your patch should not be
required.

However there's an interaction between TDB_MUTEX_LOCKING and
TDB_CLEAR_IF_FIRST.

Maybe we want something like this?

+		if (tdb_flags & TDB_CLEAR_IF_FIRST) {
+			if (tdb_runtime_check_for_robust_mutexes()) {
+				tdb_flags |= TDB_MUTEX_LOCKING;
+			}
+		}

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140930/ff1c15e3/attachment.pgp>


More information about the samba-technical mailing list