[SCM] CTDB repository - branch master updated - 80e249512f93bca2445d40590db38d31be2aafd7

Ronnie Sahlberg sahlberg at samba.org
Sun Jul 6 22:58:31 GMT 2008


The branch, master has been updated
       via  80e249512f93bca2445d40590db38d31be2aafd7 (commit)
       via  f4929e164be1703f74fc332e740b85cfe1ae3e73 (commit)
       via  ff2985aaef999d180277db4cf644fee0ea79c14d (commit)
       via  45b6ff64f6ddf037b810c4e5f8b9f04d71067b98 (commit)
       via  67bb12c8f0af5914efb44b76bc6ddbb11fc0fcdf (commit)
       via  00b1a635e3d61ca7c5487d65ac54f3eb6ea7355e (commit)
       via  f3a729998ce67f5d2e3b2ad41d96e8f04c0d18d8 (commit)
       via  ababd8aba2f9c13aaa1b623b8a76c2f98bb94dd4 (commit)
       via  015cd221c3c62eaa3cd0351fb8e93292c7c293aa (commit)
       via  07c9133aedecaee3607ad3b6fa94e5c56417a9de (commit)
       via  6d21fd57bedffce2298ce7fe4c7d889c858ba7fa (commit)
       via  9acd577c97059e8924582ac52e9ce5785903f120 (commit)
       via  4edc6d40cb63936146af99030b7819683238abfc (commit)
      from  af1f6cf7561fe9cb5c97f940d4458c83bdd8e2a0 (commit)

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


- Log -----------------------------------------------------------------
commit 80e249512f93bca2445d40590db38d31be2aafd7
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jul 7 08:53:22 2008 +1000

    zero out the sockaddr_in structure before we store the ipv4 data in it to make sure that all data is initialized. Othervise valgrind will complain about uninitialized data when we write this structure out on the wire

commit f4929e164be1703f74fc332e740b85cfe1ae3e73
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jul 7 08:52:04 2008 +1000

    we need a 'case x:' in our ugly 'encode the control opcode as a linenumber in valgrind output' hack to make it work

commit ff2985aaef999d180277db4cf644fee0ea79c14d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jul 7 08:51:05 2008 +1000

    If a transaction commit fails. Log this error and cancel all pending transactions to the
    databases instead of calling ctdb_fatal()

commit 45b6ff64f6ddf037b810c4e5f8b9f04d71067b98
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jul 7 08:50:12 2008 +1000

     in the destructor for the lock-wait child, make sure that we cancel any pending
    transactions.

commit 67bb12c8f0af5914efb44b76bc6ddbb11fc0fcdf
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 18:00:24 2008 +1000

    an extraordinarily ugly patch!
    
    This is a hack to allow backtraces under valgrind to show what opcode
    is getting uninitialised bytes

commit 00b1a635e3d61ca7c5487d65ac54f3eb6ea7355e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 17:40:25 2008 +1000

    ensure pad bytes in the ltdb_header are initialised

commit f3a729998ce67f5d2e3b2ad41d96e8f04c0d18d8
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 17:32:21 2008 +1000

    don't use mmap in tdb if --nosetsched is set. That makes valgrind
    happier (it doesn't like the mmap/msync calls in tdb)

commit ababd8aba2f9c13aaa1b623b8a76c2f98bb94dd4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 17:15:06 2008 +1000

    prevent valgrind errors where we print unitialised values on control errors

commit 015cd221c3c62eaa3cd0351fb8e93292c7c293aa
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 17:04:37 2008 +1000

    fixed a warning

commit 07c9133aedecaee3607ad3b6fa94e5c56417a9de
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 17:04:26 2008 +1000

    fixed some incorrect CTDB_NO_MEMORY*() calls found after fixing the
    _VOID varient

commit 6d21fd57bedffce2298ce7fe4c7d889c858ba7fa
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 16:58:29 2008 +1000

    CTDB_NO_MEMORY_VOID() needs to return on error

commit 9acd577c97059e8924582ac52e9ce5785903f120
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 16:58:14 2008 +1000

    added option to start ctdb under valgrind
    
    Just add CTDB_VALGRIND=yes in /etc/sysconfig/ctdb, and look at the
    logs in /var/log/ctdb_valgrind.*

commit 4edc6d40cb63936146af99030b7819683238abfc
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Jul 4 16:05:04 2008 +1000

    zero out the ctdb->freeze_handle when we free it
    
    This prevents heap corruption when a freeze child dies

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

Summary of changes:
 client/ctdb_client.c      |   21 +++++++--
 common/ctdb_ltdb.c        |    3 +-
 common/ctdb_util.c        |    2 +
 config/ctdb.init          |   14 +++++-
 include/ctdb_private.h    |    3 +-
 server/ctdb_control.c     |    5 +-
 server/ctdb_freeze.c      |   42 ++++++++++++++--
 server/ctdb_ltdb_server.c |    8 +++-
 server/ctdb_recover.c     |    2 +-
 server/ctdb_recoverd.c    |   15 ++++--
 server/ctdb_server.c      |  115 +++++++++++++++++++++++++++++++++++++++++++++
 server/ctdb_takeover.c    |    4 +-
 12 files changed, 210 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 2158d48..ed999f2 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -25,6 +25,7 @@
 #include "lib/events/events.h"
 #include "system/network.h"
 #include "system/filesys.h"
+#include "system/locale.h"
 #include "../include/ctdb_private.h"
 #include "lib/util/dlinklist.h"
 
@@ -883,6 +884,13 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
 {
 	TALLOC_CTX *tmp_ctx;
 
+	if (status != NULL) {
+		*status = -1;
+	}
+	if (errormsg != NULL) {
+		*errormsg = NULL;
+	}
+
 	if (state == NULL) {
 		return -1;
 	}
@@ -1306,7 +1314,7 @@ int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
 
 	len = offsetof(struct ctdb_vnn_map_wire, map) + sizeof(uint32_t)*vnnmap->size;
 	map = talloc_size(mem_ctx, len);
-	CTDB_NO_MEMORY_VOID(ctdb, map);
+	CTDB_NO_MEMORY(ctdb, map);
 
 	map->generation = vnnmap->generation;
 	map->size = vnnmap->size;
@@ -1682,7 +1690,12 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
 		return NULL;
 	}
 
-	ctdb_db->ltdb = tdb_wrap_open(ctdb, ctdb_db->db_path, 0, persistent?TDB_DEFAULT:TDB_NOSYNC, O_RDWR, 0);
+	tdb_flags = persistent?TDB_DEFAULT:TDB_NOSYNC;
+	if (!ctdb->do_setsched) {
+		tdb_flags |= TDB_NOMMAP;
+	}
+
+	ctdb_db->ltdb = tdb_wrap_open(ctdb, ctdb_db->db_path, 0, tdb_flags, O_RDWR, 0);
 	if (ctdb_db->ltdb == NULL) {
 		ctdb_set_error(ctdb, "Failed to open tdb '%s'\n", ctdb_db->db_path);
 		talloc_free(ctdb_db);
@@ -1846,7 +1859,7 @@ static int dumpdb_fn(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, voi
 	fprintf(f, "dmaster: %u\n", h->dmaster);
 	fprintf(f, "rsn: %llu\n", (unsigned long long)h->rsn);
 
-	fprintf(f, "key(%d) = \"", key.dsize);
+	fprintf(f, "key(%u) = \"", (unsigned)key.dsize);
 	for (i=0;i<key.dsize;i++) {
 		if (isascii(key.dptr[i])) {
 			fprintf(f, "%c", key.dptr[i]);
@@ -1856,7 +1869,7 @@ static int dumpdb_fn(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, voi
 	}
 	fprintf(f, "\"\n");
 
-	fprintf(f, "data(%d) = \"", data.dsize);
+	fprintf(f, "data(%u) = \"", (unsigned)data.dsize);
 	for (i=sizeof(*h);i<data.dsize;i++) {
 		if (isascii(data.dptr[i])) {
 			fprintf(f, "%c", data.dptr[i]);
diff --git a/common/ctdb_ltdb.c b/common/ctdb_ltdb.c
index a6bf268..f360458 100644
--- a/common/ctdb_ltdb.c
+++ b/common/ctdb_ltdb.c
@@ -62,11 +62,10 @@ static void ltdb_initial_header(struct ctdb_db_context *ctdb_db,
 				TDB_DATA key,
 				struct ctdb_ltdb_header *header)
 {
-	header->rsn = 0;
+	ZERO_STRUCTP(header);
 	/* initial dmaster is the lmaster */
 	header->dmaster = ctdb_lmaster(ctdb_db->ctdb, &key);
 	header->laccessor = header->dmaster;
-	header->lacount = 0;
 }
 
 
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index 6856c17..1b0988d 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -394,6 +394,8 @@ bool parse_ip(const char *addr, ctdb_sock_addr *saddr)
  */
 bool parse_ip_mask(const char *s, struct sockaddr_in *ip, unsigned *mask)
 {
+	ZERO_STRUCT(*ip);
+
 	if (!parse_ip_num(s, &ip->sin_addr, mask, '/')) {
 		return false;
 	}
diff --git a/config/ctdb.init b/config/ctdb.init
index 88ecc77..760d6de 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -73,7 +73,9 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
 	CTDB_OPTIONS="$CTDB_OPTIONS --no-lmaster"
 }
 
-if [ -x /sbin/startproc ]; then
+if [ "$CTDB_VALGRIND" = "yes" ]; then
+    init_style="valgrind"
+else if [ -x /sbin/startproc ]; then
     init_style="suse"
 else if [ -x /sbin/start-stop-daemon ]; then
 	init_style="ubuntu"
@@ -81,6 +83,7 @@ else if [ -x /sbin/start-stop-daemon ]; then
 	init_style="redhat"
     fi
 fi
+fi
 
 start() {
         killall -q ctdbd
@@ -100,6 +103,10 @@ start() {
 	done
 
 	case $init_style in
+	    valgrind)
+		valgrind -q --log-file=/var/log/ctdb_valgrind /usr/sbin/ctdbd --nosetsched $CTDB_OPTIONS 
+		RETVAL=0
+		;;
 	    suse)
 		startproc /usr/sbin/ctdbd $CTDB_OPTIONS
 		rc_status -v
@@ -134,6 +141,11 @@ stop() {
 	ctdb shutdown
 	RETVAL=$?
 	count=0
+	if [ "$init_style" = "valgrind" ]; then
+	    # very crude method
+	    sleep 2
+	    pkill -9 -f valgrind
+	fi
 	while killall -q -0 ctdbd; do
 	    sleep 1
 	    count=`expr $count + 1`
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index e5a7b80..ad4805f 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -439,7 +439,7 @@ struct ctdb_db_context {
 #define CTDB_NO_MEMORY_VOID(ctdb, p) do { if (!(p)) { \
           DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
           ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
-	  }} while (0)
+	  return; }} while (0)
 
 #define CTDB_NO_MEMORY_NULL(ctdb, p) do { if (!(p)) { \
           DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
@@ -811,6 +811,7 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
 int ctdb_ltdb_persistent_store(struct ctdb_db_context *ctdb_db, TDB_DATA key, 
 		    struct ctdb_ltdb_header *header, TDB_DATA data);
 void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
+void ctdb_queue_packet_opcode(struct ctdb_context *ctdb, struct ctdb_req_header *hdr, unsigned opcode);
 int ctdb_ltdb_lock_requeue(struct ctdb_db_context *ctdb_db, 
 			   TDB_DATA key, struct ctdb_req_header *hdr,
 			   void (*recv_pkt)(void *, struct ctdb_req_header *),
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 7d55413..aaadbae 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -400,7 +400,6 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 	}
 }
 
-
 /*
   send a reply for a ctdb control
  */
@@ -433,8 +432,8 @@ void ctdb_request_control_reply(struct ctdb_context *ctdb, struct ctdb_req_contr
 		r->errorlen = strlen(errormsg);
 		memcpy(&r->data[r->datalen], errormsg, r->errorlen);
 	}
-	
-	ctdb_queue_packet(ctdb, &r->hdr);	
+
+	ctdb_queue_packet_opcode(ctdb, &r->hdr, c->opcode);	
 
 	talloc_free(r);
 }
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index 47fb476..8e75f61 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -67,7 +67,25 @@ struct ctdb_freeze_handle {
  */	
 static int ctdb_freeze_handle_destructor(struct ctdb_freeze_handle *h)
 {
-	h->ctdb->freeze_mode = CTDB_FREEZE_NONE;
+	struct ctdb_context *ctdb = h->ctdb;
+	struct ctdb_db_context *ctdb_db;
+
+	/* cancel any pending transactions */
+	if (ctdb->freeze_handle && ctdb->freeze_handle->transaction_started) {
+		for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+			tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
+			if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
+				DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
+					 ctdb_db->db_name));
+			}
+			tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
+		}
+		ctdb->freeze_handle->transaction_started = false;
+	}
+
+	ctdb->freeze_mode = CTDB_FREEZE_NONE;
+	ctdb->freeze_handle = NULL;
+
 	kill(h->child, SIGKILL);
 	waitpid(h->child, NULL, 0);
 	return 0;
@@ -85,6 +103,9 @@ static void ctdb_freeze_lock_handler(struct event_context *ev, struct fd_event *
 
 	if (h->ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
 		DEBUG(DEBUG_INFO,("freeze child died - unfreezing\n"));
+		if (h->ctdb->freeze_handle == h) {
+			h->ctdb->freeze_handle = NULL;
+		}
 		talloc_free(h);
 		return;
 	}
@@ -122,7 +143,7 @@ static struct ctdb_freeze_handle *ctdb_freeze_lock(struct ctdb_context *ctdb)
 	struct fd_event *fde;
 
 	h = talloc_zero(ctdb, struct ctdb_freeze_handle);
-	CTDB_NO_MEMORY_VOID(ctdb, h);
+	CTDB_NO_MEMORY_NULL(ctdb, h);
 
 	h->ctdb = ctdb;
 
@@ -367,11 +388,20 @@ int32_t ctdb_control_transaction_commit(struct ctdb_context *ctdb, uint32_t id)
 	for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
 		tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
 		if (tdb_transaction_commit(ctdb_db->ltdb->tdb) != 0) {
-			DEBUG(DEBUG_ERR,(__location__ " Failed to commit transaction for db '%s'\n",
+			DEBUG(DEBUG_ERR,(__location__ " Failed to commit transaction for db '%s'. Cancel all transactions and resetting transaction_started to false.\n",
 				 ctdb_db->db_name));
-			/* this has to be fatal to maintain integrity - it should only
-			   happen if we run out of disk space */
-			ctdb_fatal(ctdb, "Unable to commit transactions\n");
+
+			/* cancel any pending transactions */
+			for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+				tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
+				if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
+					DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
+						 ctdb_db->db_name));
+				}
+				tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
+			}
+			ctdb->freeze_handle->transaction_started = false;
+
 			return -1;
 		}
 		tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index 5146ed8..a6ad4ee 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -197,6 +197,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
 	struct ctdb_db_context *ctdb_db, *tmp_db;
 	int ret;
 	struct TDB_DATA key;
+	unsigned tdb_flags;
 
 	ctdb_db = talloc_zero(ctdb, struct ctdb_db_context);
 	CTDB_NO_MEMORY(ctdb, ctdb_db);
@@ -244,9 +245,14 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
 					   persistent?ctdb->db_directory_persistent:ctdb->db_directory, 
 					   db_name, ctdb->pnn);
 
+	tdb_flags = persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC;
+	if (!ctdb->do_setsched) {
+		tdb_flags |= TDB_NOMMAP;
+	}
+
 	ctdb_db->ltdb = tdb_wrap_open(ctdb, ctdb_db->db_path, 
 				      ctdb->tunable.database_hash_size, 
-				      persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC, 
+				      tdb_flags, 
 				      O_CREAT|O_RDWR, 0666);
 	if (ctdb_db->ltdb == NULL) {
 		DEBUG(DEBUG_CRIT,("Failed to open tdb '%s'\n", ctdb_db->db_path));
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index f71f7e9..29673ea 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -74,7 +74,7 @@ ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA inda
 
 	len = offsetof(struct ctdb_vnn_map_wire, map) + sizeof(uint32_t)*ctdb->vnn_map->size;
 	map = talloc_size(outdata, len);
-	CTDB_NO_MEMORY_VOID(ctdb, map);
+	CTDB_NO_MEMORY(ctdb, map);
 
 	map->generation = ctdb->vnn_map->generation;
 	map->size = ctdb->vnn_map->size;
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index f161e7c..80443bb 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1105,6 +1105,7 @@ static struct tdb_wrap *create_recdb(struct ctdb_context *ctdb, TALLOC_CTX *mem_
 {
 	char *name;
 	struct tdb_wrap *recdb;
+	unsigned tdb_flags;
 
 	/* open up the temporary recovery database */
 	name = talloc_asprintf(mem_ctx, "%s/recdb.tdb", ctdb->db_directory);
@@ -1112,8 +1113,14 @@ static struct tdb_wrap *create_recdb(struct ctdb_context *ctdb, TALLOC_CTX *mem_
 		return NULL;
 	}
 	unlink(name);
+
+	tdb_flags = TDB_NOLOCK;
+	if (!ctdb->do_setsched) {
+		tdb_flags |= TDB_NOMMAP;
+	}
+
 	recdb = tdb_wrap_open(mem_ctx, name, ctdb->tunable.database_hash_size, 
-			      TDB_NOLOCK, O_RDWR|O_CREAT|O_EXCL, 0600);
+			      tdb_flags, O_RDWR|O_CREAT|O_EXCL, 0600);
 	if (recdb == NULL) {
 		DEBUG(DEBUG_CRIT,(__location__ " Failed to create temp recovery database '%s'\n", name));
 	}
@@ -1368,7 +1375,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
 
 	/* set recovery mode to active on all nodes */
 	ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
-	if (ret!=0) {
+	if (ret != 0) {
 		DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
 		return -1;
 	}
@@ -1508,7 +1515,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
 
 	/* disable recovery mode */
 	ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_NORMAL);
-	if (ret!=0) {
+	if (ret != 0) {
 		DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to normal on cluster\n"));
 		return -1;
 	}
@@ -1839,7 +1846,7 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
 
 	/* set all nodes to recovery mode to stop all internode traffic */
 	ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
-	if (ret!=0) {
+	if (ret != 0) {
 		DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
 		return;
 	}
diff --git a/server/ctdb_server.c b/server/ctdb_server.c
index a4c09a9..19c8c2c 100644
--- a/server/ctdb_server.c
+++ b/server/ctdb_server.c
@@ -502,3 +502,118 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 }
 
 
+
+
+/*
+  a valgrind hack to allow us to get opcode specific backtraces
+  very ugly, and relies on no compiler optimisation!
+*/
+void ctdb_queue_packet_opcode(struct ctdb_context *ctdb, struct ctdb_req_header *hdr, unsigned opcode)
+{
+	switch (opcode) {
+#define DO_OP(x) case x: ctdb_queue_packet(ctdb, hdr); break
+		DO_OP(1);
+		DO_OP(2);
+		DO_OP(3);
+		DO_OP(4);
+		DO_OP(5);
+		DO_OP(6);
+		DO_OP(7);
+		DO_OP(8);
+		DO_OP(9);
+		DO_OP(10);
+		DO_OP(11);
+		DO_OP(12);
+		DO_OP(13);
+		DO_OP(14);
+		DO_OP(15);
+		DO_OP(16);
+		DO_OP(17);
+		DO_OP(18);
+		DO_OP(19);
+		DO_OP(20);
+		DO_OP(21);
+		DO_OP(22);
+		DO_OP(23);
+		DO_OP(24);
+		DO_OP(25);
+		DO_OP(26);
+		DO_OP(27);
+		DO_OP(28);
+		DO_OP(29);
+		DO_OP(30);
+		DO_OP(31);
+		DO_OP(32);
+		DO_OP(33);
+		DO_OP(34);
+		DO_OP(35);
+		DO_OP(36);
+		DO_OP(37);
+		DO_OP(38);
+		DO_OP(39);
+		DO_OP(40);
+		DO_OP(41);
+		DO_OP(42);
+		DO_OP(43);
+		DO_OP(44);
+		DO_OP(45);
+		DO_OP(46);
+		DO_OP(47);
+		DO_OP(48);
+		DO_OP(49);
+		DO_OP(50);
+		DO_OP(51);
+		DO_OP(52);
+		DO_OP(53);
+		DO_OP(54);
+		DO_OP(55);
+		DO_OP(56);
+		DO_OP(57);
+		DO_OP(58);
+		DO_OP(59);
+		DO_OP(60);
+		DO_OP(61);
+		DO_OP(62);
+		DO_OP(63);
+		DO_OP(64);
+		DO_OP(65);
+		DO_OP(66);
+		DO_OP(67);
+		DO_OP(68);
+		DO_OP(69);
+		DO_OP(70);
+		DO_OP(71);
+		DO_OP(72);
+		DO_OP(73);
+		DO_OP(74);
+		DO_OP(75);
+		DO_OP(76);
+		DO_OP(77);
+		DO_OP(78);
+		DO_OP(79);
+		DO_OP(80);
+		DO_OP(81);
+		DO_OP(82);
+		DO_OP(83);
+		DO_OP(84);
+		DO_OP(85);
+		DO_OP(86);
+		DO_OP(87);
+		DO_OP(88);
+		DO_OP(89);
+		DO_OP(90);
+		DO_OP(91);
+		DO_OP(92);
+		DO_OP(93);
+		DO_OP(94);
+		DO_OP(95);
+		DO_OP(96);
+		DO_OP(97);
+		DO_OP(98);
+		DO_OP(99);
+		DO_OP(100);
+	default: 
+		ctdb_queue_packet(ctdb, hdr);
+		break;
+	}
+}
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index c4b6c82..10369d4 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -1775,7 +1775,9 @@ int32_t ctdb_control_send_gratious_arp(struct ctdb_context *ctdb, TDB_DATA indat
 
 	/* verify the size of indata */
 	if (indata.dsize < offsetof(struct ctdb_control_gratious_arp, iface)) {
-		DEBUG(DEBUG_ERR,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure. Got %u require %u bytes\n", indata.dsize, offsetof(struct ctdb_control_gratious_arp, iface)));
+		DEBUG(DEBUG_ERR,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure. Got %u require %u bytes\n", 
+				 (unsigned)indata.dsize, 
+				 (unsigned)offsetof(struct ctdb_control_gratious_arp, iface)));
 		return -1;
 	}
 	if (indata.dsize != 


-- 
CTDB repository


More information about the samba-cvs mailing list