[SCM] CTDB repository - branch 1.0.112 updated - ctdb-1.0.111-95-g9a38f95

Ronnie Sahlberg sahlberg at samba.org
Mon Jun 7 20:22:20 MDT 2010


The branch, 1.0.112 has been updated
       via  9a38f9598e6f81fe25347487b51b62703a41922f (commit)
       via  599fd54ea34a9b007828ffe32392709e8f2628f9 (commit)
       via  e682860568cdeabeecbd50aca3568848fc5b923e (commit)
      from  968a88f0bf0747d2ca7da48d5661d7b2df090c83 (commit)

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


- Log -----------------------------------------------------------------
commit 9a38f9598e6f81fe25347487b51b62703a41922f
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Jun 8 12:17:01 2010 +1000

    New version 1.0.112-23
    
    * Tue Jun 8 2010 : Version 1.0.112-23
     - Fix a SEGV that can be triggered by "ctdb delip"
       BZ 62783
     - Add iptables filters to stop clients from connecting to the NATGW
       address.
       BZ62613
     - Add timestamps to the ctdb statistics output
     - Change "ctdb addip" to block until the address is active
       BZ63191
     - Add additional log messages when tdbs can no longer be locked/chain
       unlocked
       BZ64688

commit 599fd54ea34a9b007828ffe32392709e8f2628f9
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Jun 8 12:09:19 2010 +1000

    Additional log messages when tdb databases can no longer be chainlocked or chainunlocked
    
    BZ64688

commit e682860568cdeabeecbd50aca3568848fc5b923e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jun 7 14:26:08 2010 +1000

    change the addip command to wait until the ip address is taken by the proper node
    
    BZ63191

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

Summary of changes:
 common/ctdb_ltdb.c         |    2 +-
 packaging/RPM/ctdb.spec.in |   14 ++++++++++-
 server/ctdb_freeze.c       |    2 +
 tools/ctdb.c               |   58 +++++++++++++++++++++++++++++++++++++-------
 4 files changed, 65 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_ltdb.c b/common/ctdb_ltdb.c
index b2fd189..d35b690 100644
--- a/common/ctdb_ltdb.c
+++ b/common/ctdb_ltdb.c
@@ -191,7 +191,7 @@ int ctdb_ltdb_unlock(struct ctdb_db_context *ctdb_db, TDB_DATA key)
 {
 	int ret = tdb_chainunlock(ctdb_db->ltdb->tdb, key);
 	if (ret != 0) {
-		DEBUG(DEBUG_ERR,("tdb_chainunlock failed\n"));
+		DEBUG(DEBUG_ERR,(__location__ " tdb_chainunlock failed on database %s\n", ctdb_db->db_name));
 	}
 	return ret;
 }
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 42179e5..bdcf6e2 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
 Version: 1.0.112
-Release: 22
+Release: 23
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -125,6 +125,18 @@ rm -rf $RPM_BUILD_ROOT
 %{_docdir}/ctdb/tests/bin/ctdb_transaction
 
 %changelog
+* Tue Jun 8 2010 : Version 1.0.112-23
+ - Fix a SEGV that can be triggered by "ctdb delip"
+   BZ 62783
+ - Add iptables filters to stop clients from connecting to the NATGW
+   address.
+   BZ62613
+ - Add timestamps to the ctdb statistics output
+ - Change "ctdb addip" to block until the address is active
+   BZ63191
+ - Add additional log messages when tdbs can no longer be locked/chain
+   unlocked
+   BZ64688
 * Mon May 24 2010 : Version 1.0.112-22
  - Fix bug in 62.cnfs to allow exports that are quoted.
  - Add monitoring og Quorum for the 62.cnfs script
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index 3852008..70333b0 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -48,6 +48,7 @@ static int ctdb_lock_all_databases(struct ctdb_context *ctdb, uint32_t priority)
 		}
 		DEBUG(DEBUG_INFO,("locking database 0x%08x priority:%u %s\n", ctdb_db->db_id, ctdb_db->priority, ctdb_db->db_name));
 		if (tdb_lockall(ctdb_db->ltdb->tdb) != 0) {
+			DEBUG(DEBUG_ERR,(__location__ " Failed to lock database %s\n", ctdb_db->db_name));
 			return -1;
 		}
 	}
@@ -60,6 +61,7 @@ static int ctdb_lock_all_databases(struct ctdb_context *ctdb, uint32_t priority)
 		}
 		DEBUG(DEBUG_INFO,("locking database 0x%08x priority:%u %s\n", ctdb_db->db_id, ctdb_db->priority, ctdb_db->db_name));
 		if (tdb_lockall(ctdb_db->ltdb->tdb) != 0) {
+			DEBUG(DEBUG_ERR,(__location__ " Failed to lock database %s\n", ctdb_db->db_name));
 			return -1;
 		}
 	}
diff --git a/tools/ctdb.c b/tools/ctdb.c
index c59a8b4..6daddb0 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -56,6 +56,8 @@ static int control_version(struct ctdb_context *ctdb, int argc, const char **arg
 }
 #endif
 
+static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char **argv);
+
 
 /*
   verify that a node exists and is reachable
@@ -1057,6 +1059,7 @@ static int move_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr, uint32_t pnn
 		return -1;
 	}
 
+
 	talloc_free(tmp_ctx);
 	return 0;
 }
@@ -1315,12 +1318,43 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
 	} else {
 		pnn  = ips->ips[i].pnn;
 	}
+	talloc_free(ips);
+	ips = NULL;
 
-	if (move_ip(ctdb, &addr, pnn) != 0) {
+again:
+	ret = move_ip(ctdb, &addr, pnn);
+	if (ret != 0) {
 		DEBUG(DEBUG_ERR,("Failed to move ip to node %d\n", pnn));
+		return ret;
+	}
+
+	ret = control_ipreallocate(ctdb, argc, argv);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,("IP Reallocate failed on node %u\n", options.pnn));
+		return ret;
+	}
+
+	/* read the public ip list from the node */
+	ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), pnn, ctdb, &ips);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, ("Unable to get public ip list from node %u\n", pnn));
+		talloc_free(tmp_ctx);
 		return -1;
 	}
 
+	/* make sure the ip is held by node pnn */
+	for (i=0; i < ips->num; i++) {
+		if (ctdb_same_ip(&addr, &ips->ips[i].addr)) {
+			break;
+		}
+	}
+	if (i == ips->num) {
+		DEBUG(DEBUG_ERR,(__location__ " Move ip failed. Trying it again=\n"));
+		talloc_free(ips);
+		ips = NULL;
+		goto again;
+	}
+
 	talloc_free(tmp_ctx);
 	return 0;
 }
@@ -1726,7 +1760,9 @@ static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv
 static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid, 
 			     TDB_DATA data, void *private_data)
 {
-	exit(0);
+	uint32_t *trigger = private_data;
+
+	*trigger = 1;
 }
 
 static void ctdb_every_second(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
@@ -1750,6 +1786,7 @@ static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char
 	struct ctdb_node_map *nodemap=NULL;
 	int retries=0;
 	struct timeval tv = timeval_current();
+	uint32_t rmcb;
 
 	/* we need some events to trigger so we can timeout and restart
 	   the loop
@@ -1768,7 +1805,7 @@ static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char
 	/* register a message port for receiveing the reply so that we
 	   can receive the reply
 	*/
-	ctdb_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
+	ctdb_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, &rmcb);
 
 	data.dptr = (uint8_t *)&rd;
 	data.dsize = sizeof(rd);
@@ -1803,7 +1840,7 @@ again:
 	}
 
 
-	/* check tha there are nodes available that can act as a recmaster */
+	/* check that there are nodes available that can act as a recmaster */
 	for (i=0; i<nodemap->num; i++) {
 		if (nodemap->nodes[i].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
 			continue;
@@ -1832,6 +1869,7 @@ again:
 		goto again;
 	} 
 
+	rmcb = 0;
 	ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_TAKEOVER_RUN, data);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR,("Failed to send ip takeover run request message to %u\n", options.pnn));
@@ -1840,14 +1878,16 @@ again:
 
 	tv = timeval_current();
 	/* this loop will terminate when we have received the reply */
-	while (timeval_elapsed(&tv) < 3.0) {
+	while (rmcb == 0 && timeval_elapsed(&tv) < 3.0) {
 		event_loop_once(ctdb->ev);
 	}
 
-	DEBUG(DEBUG_ERR,("Timed out waiting for recmaster ipreallocate. Trying again\n"));
-	retries++;
-	sleep(1);
-	goto again;
+	if (rmcb == 0) {
+		DEBUG(DEBUG_ERR,("Timed out waiting for recmaster ipreallocate. Trying again\n"));
+		retries++;
+		sleep(1);
+		goto again;
+	}
 
 	return 0;
 }


-- 
CTDB repository


More information about the samba-cvs mailing list