protection against tdb mutex regressions

Stefan Metzmacher metze at samba.org
Tue Feb 2 12:19:38 UTC 2016


Hi,

here're patches which add dbwrap_tdb_require_mutexes:*= options,
similar to add dbwrap_tdb_mutexes:*=.

We configure this during make test unless
SELFTEST_DONT_REQUIRE_TDB_MUTEX_SUPPORT=1
is set in the environment.

Please review and push:-)

Thanks!
metze
-------------- next part --------------
From 76802f270db691f5b47254941bc842fd6ca5e334 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sat, 16 Jan 2016 10:19:23 +0100
Subject: [PATCH 1/2] s3:dbwrap: add dbwrap_tdb_require_mutexes:*= option

This is similar to dbwrap_tdb_mutexes:*= (which is autodetected by default),
but dbwrap_tdb_require_mutexes is off by default.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source3/lib/dbwrap/dbwrap_open.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 59fb3e4..98e4f41 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -97,6 +97,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 	if (tdb_flags & TDB_CLEAR_IF_FIRST) {
 		const char *base;
 		bool try_mutex = false;
+		bool require_mutex = false;
 
 		base = strrchr_m(name, '/');
 		if (base != NULL) {
@@ -111,6 +112,15 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 		if (try_mutex && tdb_runtime_check_for_robust_mutexes()) {
 			tdb_flags |= TDB_MUTEX_LOCKING;
 		}
+
+		require_mutex = lp_parm_bool(-1, "dbwrap_tdb_require_mutexes",
+					   "*", require_mutex);
+		require_mutex = lp_parm_bool(-1, "dbwrap_tdb_require_mutexes",
+					   base, require_mutex);
+
+		if (require_mutex) {
+			tdb_flags |= TDB_MUTEX_LOCKING;
+		}
 	}
 
 	sockname = lp_ctdbd_socket();
-- 
1.9.1


From 6a26a2cc3fc97b0e832aafd800281d8962190f95 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sat, 16 Jan 2016 10:20:32 +0100
Subject: [PATCH 2/2] selftest: add dbwrap_tdb_require_mutexes:* = yes, when
 using dbwrap_tdb_mutexes:* = yes by default

export SELFTEST_DONT_REQUIRE_TDB_MUTEX_SUPPORT=1 can overwrite this.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 selftest/target/Samba3.pm | 4 ++++
 selftest/target/Samba4.pm | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 5002a81..9ed827f 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -308,10 +308,14 @@ sub setup_nt4_member($$$)
 
 	print "PROVISIONING MEMBER...";
 
+	my $require_mutexes = "dbwrap_tdb_require_mutexes:* = yes";
+	$require_mutexes = "" if ($ENV{SELFTEST_DONT_REQUIRE_TDB_MUTEX_SUPPORT} eq "1");
+
 	my $member_options = "
 	security = domain
 	server signing = on
 	dbwrap_tdb_mutexes:* = yes
+	${require_mutexes}
 ";
 	my $ret = $self->provision($prefix,
 				   "LOCALNT4MEMBER3",
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index fbefda7..2343cec 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -1794,11 +1794,15 @@ sub provision_ad_dc($$)
 	my $lockdir="$prefix_abs/lockdir";
         my $conffile="$prefix_abs/etc/smb.conf";
 
+	my $require_mutexes = "dbwrap_tdb_require_mutexes:* = yes";
+	$require_mutexes = "" if ($ENV{SELFTEST_DONT_REQUIRE_TDB_MUTEX_SUPPORT} eq "1");
+
 	my $extra_smbconf_options = "
         server services = -smb +s3fs
         xattr_tdb:file = $prefix_abs/statedir/xattr.tdb
 
 	dbwrap_tdb_mutexes:* = yes
+	${require_mutexes}
 
 	kernel oplocks = no
 	kernel change notify = no
-- 
1.9.1

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


More information about the samba-technical mailing list