[SCM] CTDB repository - branch 1.0.82 updated - ctdb-1.0.82-62-g1fc7754

Ronnie Sahlberg sahlberg at samba.org
Fri Nov 6 01:48:53 MST 2009


The branch, 1.0.82 has been updated
       via  1fc775441e6902e25989268f7395f48bdbc2a5d3 (commit)
       via  7fe669e5f9302f1a5eae6ff18bd188f4e739f0ee (commit)
       via  1975b53b5ea608d60b8b3e527a435a7c817a97ea (commit)
      from  9708b176895b566463d14f6d690821b8305f117b (commit)

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


- Log -----------------------------------------------------------------
commit 1fc775441e6902e25989268f7395f48bdbc2a5d3
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 6 19:48:12 2009 +1100

    version 1.0.82-16

commit 7fe669e5f9302f1a5eae6ff18bd188f4e739f0ee
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 6 19:45:07 2009 +1100

    From Wolfgang Mueller
    
    Backport a patch from head for updating nodes flags
    
    also make sure that when a node repotrs incinsistent node flags, we mark it as a culprit so that if it insists in retaining an opinion not accepted in the cluster groupthink we ban it quickly.

commit 1975b53b5ea608d60b8b3e527a435a7c817a97ea
Author: root <root at rhel5vm.(none)>
Date:   Thu Nov 5 16:53:26 2009 +0100

    prevent doubly freeing memory on invalid packet

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

Summary of changes:
 packaging/RPM/ctdb.spec |    5 ++++-
 server/ctdb_monitor.c   |    3 +++
 server/ctdb_recoverd.c  |   42 ++++++++++++++++++++++++++++++++++++++++--
 tcp/tcp_io.c            |   10 +++++++++-
 4 files changed, 56 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index dacee13..534e128 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
 Version: 1.0.82
-Release: 15
+Release: 16
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -133,6 +133,9 @@ fi
 %{_libdir}/pkgconfig/ctdb.pc
 
 %changelog
+* Fri Nov 6 2009 : Version 1.0.82-16
+ - a tallock free bug in tcp transport   fixed by wolfgang mueller
+ - make sure to ban nodes quuickly if they disagree on the flags of the nodes in teh cluster
 * Thu Oct 29 2009 : Version 1.0.82-15
  - From wolfgang m: fix a bug int eh vacuuming
  - revert the previous dmaster bug workaround, was the same bug as above
diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index 14da3b7..25d2226 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -293,6 +293,9 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
 
 	node         = ctdb->nodes[c->pnn];
 	c->old_flags  = node->flags;
+	if (c->pnn != ctdb->pnn) {
+		c->old_flags = node->flags;
+	}
 	node->flags   = c->new_flags & ~NODE_FLAGS_DISCONNECTED;
 	node->flags  |= (c->old_flags & NODE_FLAGS_DISCONNECTED);
 
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index e065ed5..31335d9 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1992,11 +1992,46 @@ static void push_flags_handler(struct ctdb_context *ctdb, uint64_t srvid,
 {
 	int ret;
 	struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
+	struct ctdb_node_map *nodemap=NULL;
+	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+	uint32_t recmaster;
+	uint32_t *nodes;
 
-	ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), c->pnn, c->new_flags, ~c->new_flags);
+	/* find the recovery master */
+	ret = ctdb_ctrl_getrecmaster(ctdb, tmp_ctx, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &recmaster);
 	if (ret != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on remote nodes\n"));
+		DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from local node\n"));
+		talloc_free(tmp_ctx);
+		return;
 	}
+	/* read the node flags from the recmaster */
+ 
+	ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), recmaster, tmp_ctx, &nodemap);
+ 	if (ret != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from node %u\n", c->pnn));
+		talloc_free(tmp_ctx);
+		return;
+	}
+
+	if (c->pnn >= nodemap->num) {
+		DEBUG(DEBUG_ERR,(__location__ " Nodemap from recmaster does not contain node %d\n", c->pnn));
+		talloc_free(tmp_ctx);
+		return;
+	}
+
+	/* send the flags update to all connected nodes */
+	nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+
+	if (ctdb_client_async_control(ctdb, CTDB_CONTROL_MODIFY_FLAGS,
+								  nodes, CONTROL_TIMEOUT(),
+								  false, data,
+								  NULL, NULL,
+								  NULL) != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " ctdb_control to modify node flags failed\n"));
+		talloc_free(tmp_ctx);
+		return;
+ 	}
+	talloc_free(tmp_ctx);
 }
 
 
@@ -2739,6 +2774,9 @@ again:
 				  nodemap->nodes[i].pnn, 
 				  remote_nodemaps[j]->nodes[i].flags,
 				  nodemap->nodes[j].flags));
+
+				ctdb_set_culprit_count(rec, nodemap->nodes[j].pnn, 4);
+
 				if (i == j) {
 					DEBUG(DEBUG_ERR,("Use flags 0x%02x from remote node %d for cluster update of its own flags\n", remote_nodemaps[j]->nodes[i].flags, j));
 					update_flags_on_all_nodes(ctdb, nodemap, nodemap->nodes[i].pnn, remote_nodemaps[j]->nodes[i].flags);
diff --git a/tcp/tcp_io.c b/tcp/tcp_io.c
index 10711d1..257446c 100644
--- a/tcp/tcp_io.c
+++ b/tcp/tcp_io.c
@@ -75,7 +75,15 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
 	return;
 
 failed:
-	talloc_free(in);
+	/*
+	 * removed the talloc_free(in) in order to prevent a double free on 'in'
+	 * Questions: 
+	 *  - Are we introducing a memory leak? I don't think so.
+	 *  - Is there a destructor missing that removes this block from the queue
+	 *    it was already added? Yes, I think this is missing.
+	 *  - Why do we get such invalid packages? Hmm....
+	 */
+	return;
 }
 
 /*


-- 
CTDB repository


More information about the samba-cvs mailing list