[SCM] CTDB repository - branch master updated - ctdb-2.0-18-g5067392

Amitay Isaacs amitay at samba.org
Sun Jan 6 16:39:17 MST 2013


The branch, master has been updated
       via  5067392d2e06795559f25828b65c129608b65c0b (commit)
       via  81788cfabe960497b050c5ee4e4e487ee061012a (commit)
       via  4a9e96ad3d8fc46da1cd44cd82309c1b54301eb7 (commit)
      from  f81e9add466b1d9b2796c09c6ba63b77296ea149 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5067392d2e06795559f25828b65c129608b65c0b
Author: Michael Adam <obnox at samba.org>
Date:   Tue Nov 20 11:20:34 2012 +0100

    ctdb:recover: fix a comment typo
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit 81788cfabe960497b050c5ee4e4e487ee061012a
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 21 11:52:57 2012 -0500

    events/50.samba: fix testparm background update
    
    creating the smb.conf cache with "-v" results in a cache file
    that fails to load with "testparm -s ..." later on due to
    "copy = " not being processable. (Copying the empty service name fails).
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit 4a9e96ad3d8fc46da1cd44cd82309c1b54301eb7
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Jan 4 14:32:55 2013 +1100

    daemon: Add a tunable to enable automatic database priority setting
    
    Samba versions 3.6.x and older do not set the database priority.
    This can cause deadlock between Samba and CTDB since the locking order
    of database will be different. A hack was added for automatic promotion
    of priority for specific databases to avoid deadlock.  This code should
    not be invoked with Samba version 4.x which correctly specifies the
    priority for each database.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Michael Adam <obnox at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 config/events.d/50.samba |    2 +-
 doc/ctdbd.1.xml          |   13 +++++++++++++
 include/ctdb_private.h   |    1 +
 server/ctdb_lock.c       |   14 +++++++++-----
 server/ctdb_recover.c    |    2 +-
 server/ctdb_tunables.c   |    1 +
 6 files changed, 26 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 4d9f121..a4d50fe 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -96,7 +96,7 @@ testparm_background_update() {
     # otherwise do a background update
     (
 	tmpfile="${smbconf_cache}.$$"
-	testparm -v -s > $tmpfile 2> /dev/null &
+	testparm -s > $tmpfile 2> /dev/null &
 	# remember the pid of the teamparm process
 	pid="$!"
 	# give it 10 seconds to run
diff --git a/doc/ctdbd.1.xml b/doc/ctdbd.1.xml
index d192feb..a0cba99 100644
--- a/doc/ctdbd.1.xml
+++ b/doc/ctdbd.1.xml
@@ -1098,6 +1098,19 @@
     detection.
     </para>
     </refsect2>
+
+    <refsect2><title>Samba3AvoidDeadlock</title>
+    <para>Default: 0</para>
+    <para>
+    Enable code that prevents deadlocks with Samba (only for Samba 3.x).
+    </para>
+    <para>
+    This should be set to 1 when using Samba version 3.x to enable special
+    code in CTDB to avoid deadlock with Samba version 3.x.  This code
+    is not required for Samba version 4.x and must not be enabled for
+    Samba 4.x.
+    </para>
+    </refsect2>
   </refsect1>
 
   <refsect1><title>LVS</title>
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 348df09..582a767 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -137,6 +137,7 @@ struct ctdb_tunable {
 	uint32_t pulldb_preallocation_size;
 	uint32_t no_ip_takeover_on_disabled;
 	uint32_t deadlock_timeout;
+	uint32_t samba3_hack;
 };
 
 /*
diff --git a/server/ctdb_lock.c b/server/ctdb_lock.c
index e78f3fc..8a2ba5c 100644
--- a/server/ctdb_lock.c
+++ b/server/ctdb_lock.c
@@ -96,8 +96,12 @@ struct lock_request {
  * By default, all databases are set to priority 1. So only when priority
  * is set to 1, check for databases that need higher priority.
  */
-static bool later_db(const char *name)
+static bool later_db(struct ctdb_context *ctdb, const char *name)
 {
+	if (ctdb->tunable.samba3_hack == 0) {
+		return false;
+	}
+
 	if (strstr(name, "brlock") ||
 	    strstr(name, "g_lock") ||
 	    strstr(name, "notify_onelevel") ||
@@ -120,7 +124,7 @@ int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t priority)
 		if (ctdb_db->priority != priority) {
 			continue;
 		}
-		if (later_db(ctdb_db->db_name)) {
+		if (later_db(ctdb, ctdb_db->db_name)) {
 			continue;
 		}
 		DEBUG(DEBUG_INFO, ("locking database %s, priority:%u\n",
@@ -138,7 +142,7 @@ int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t priority)
 	}
 
 	for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) {
-		if (!later_db(ctdb_db->db_name)) {
+		if (!later_db(ctdb, ctdb_db->db_name)) {
 			continue;
 		}
 		DEBUG(DEBUG_INFO, ("locking database %s, priority:%u\n",
@@ -228,7 +232,7 @@ int ctdb_lockall_mark_prio(struct ctdb_context *ctdb, uint32_t priority)
 		if (ctdb_db->priority != priority) {
 			continue;
 		}
-		if (later_db(ctdb_db->db_name)) {
+		if (later_db(ctdb, ctdb_db->db_name)) {
 			continue;
 		}
 		if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) {
@@ -246,7 +250,7 @@ int ctdb_lockall_mark_prio(struct ctdb_context *ctdb, uint32_t priority)
 	}
 
 	for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) {
-		if (!later_db(ctdb_db->db_name)) {
+		if (!later_db(ctdb, ctdb_db->db_name)) {
 			continue;
 		}
 		if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) {
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index ce36b80..719352a 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -297,7 +297,7 @@ static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 }
 
 /*
-  pul a bunch of records from a ltdb, filtering by lmaster
+  pull a bunch of records from a ltdb, filtering by lmaster
  */
 int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata)
 {
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index 5bd13d5..b86d6d2 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -86,6 +86,7 @@ static const struct {
 	{ "PullDBPreallocation", 10*1024*10240,  offsetof(struct ctdb_tunable, pulldb_preallocation_size), false },
 	{ "NoIPTakeoverOnDisabled",    0,  offsetof(struct ctdb_tunable, no_ip_takeover_on_disabled), false },
 	{ "DeadlockTimeout",	300, offsetof(struct ctdb_tunable, deadlock_timeout), false },
+	{ "Samba3AvoidDeadlocks", 0, offsetof(struct ctdb_tunable, samba3_hack), false },
 };
 
 /*


-- 
CTDB repository


More information about the samba-cvs mailing list