[SCM] CTDB repository - branch master updated - ctdb-2.2-120-g412bc0e

Amitay Isaacs amitay at samba.org
Thu Jul 11 01:05:38 MDT 2013


The branch, master has been updated
       via  412bc0e20bef694d4e911dc9c984fd7716231f1f (commit)
       via  a4afe7af9c9391048d6f80135bbd5e15367770c7 (commit)
       via  40f2825d6e818dc8c745b6385a545969dfb45fbc (commit)
       via  76703514040b804b880cab909f6ff52576f80f89 (commit)
       via  0930a3b806977555509c3228726e2250aef1f971 (commit)
       via  a81edf7eb908659a379f0cb55fd5d04551dc2c37 (commit)
       via  da87395d29f5d11ecfedaf36b53fa060a9140bfd (commit)
       via  05bfdbbd0d4abdfbcf28e3930086723508b35952 (commit)
       via  5cdcc3d45d358ddbcd7e864898eed9cbd9935429 (commit)
       via  ed9ba1d3dcfcb51aa69bf4d7a74b95063743d8d9 (commit)
      from  9ffcd6a91287d86bae7b0c73aa129c81126e08e7 (commit)

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


- Log -----------------------------------------------------------------
commit 412bc0e20bef694d4e911dc9c984fd7716231f1f
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 11 14:26:38 2013 +1000

    scripts: ctdbd_wrapper logs a message to syslog if syslog is not being used
    
    It can be very disconcerting when logging to syslog is expected but
    nothing is being logged there.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit a4afe7af9c9391048d6f80135bbd5e15367770c7
Author: Mathieu Parent <math.parent at gmail.com>
Date:   Fri Jun 7 19:01:06 2013 +0200

    Update Nagios check to work with ctdb versions past 30 Aug 2011
    
    Because of commit a779d83a6213e2ba
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 40f2825d6e818dc8c745b6385a545969dfb45fbc
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 11 13:01:13 2013 +1000

    recoverd: Really fix bogus info in message about changed flags
    
    Commit 9119a568c2b4601318f7751f537dca2f92a7230b attempted to fix this.
    However, this was wrong because old_flags and new_flags were confused.
    The latter has since been fixed in commit
    7eb2f89979360b6cc98ca9b17c48310277fa89fc so this can now be fixed
    properly.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 76703514040b804b880cab909f6ff52576f80f89
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jul 10 14:44:56 2013 +1000

    doc: Update NEWS
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 0930a3b806977555509c3228726e2250aef1f971
Author: Sumit Bose <sbose at redhat.com>
Date:   Mon Nov 19 18:45:37 2012 +0100

    Print deleted nodes as well
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit a81edf7eb908659a379f0cb55fd5d04551dc2c37
Author: Sumit Bose <sbose at redhat.com>
Date:   Thu Sep 1 15:18:46 2011 +0200

    IPv6 neighbor solicit cleanup
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit da87395d29f5d11ecfedaf36b53fa060a9140bfd
Author: Sumit Bose <sbose at redhat.com>
Date:   Mon Nov 19 11:13:03 2012 +0100

    Fix memory leak in ctdb_send_message()
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 05bfdbbd0d4abdfbcf28e3930086723508b35952
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed Aug 10 17:53:56 2011 +0200

    Fixes for various issues found by Coverity
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 5cdcc3d45d358ddbcd7e864898eed9cbd9935429
Author: Sumit Bose <sbose at redhat.com>
Date:   Mon Nov 19 11:20:31 2012 +0100

    Check return value of tdb_delete()
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit ed9ba1d3dcfcb51aa69bf4d7a74b95063743d8d9
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 11 13:46:18 2013 +1000

    web: Update webpages
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 NEWS                      |    2 ++
 client/ctdb_client.c      |    8 ++------
 common/ctdb_logging.c     |   12 ++++++++++--
 common/system_linux.c     |   15 ++++++++-------
 config/ctdbd_wrapper      |    8 ++++++++
 server/ctdb_daemon.c      |    3 +++
 server/ctdb_logging.c     |    4 ++++
 server/ctdb_ltdb_server.c |    5 ++++-
 server/ctdb_recover.c     |    4 +++-
 server/ctdb_recoverd.c    |    8 ++++----
 server/eventscript.c      |    4 +++-
 tcp/tcp_connect.c         |   11 ++++++++++-
 tests/src/ctdb_fetch.c    |    5 +++++
 tools/ctdb.c              |   13 ++++++++++++-
 utils/nagios/check_ctdb   |    6 +++++-
 web/samba.html            |   12 +++---------
 16 files changed, 86 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/NEWS b/NEWS
index bde89d6..12aec37 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ User-visible changes
 * Initscript is now simplified with most CTDB-specific functionality
   split out to ctdbd_wrapper, which is used to start and stop ctdbd.
 
+* Add systemd support.
+
 * CTDB subprocesses are now given informative names to allow them to
   be easily distinguished when using programs like "top" or "perf".
 
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 5881559..08e4903 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -541,12 +541,8 @@ int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
 	memcpy(&r->data[0], data.dptr, data.dsize);
 	
 	res = ctdb_client_queue_pkt(ctdb, &r->hdr);
-	if (res != 0) {
-		return res;
-	}
-
 	talloc_free(r);
-	return 0;
+	return res;
 }
 
 
@@ -3315,7 +3311,7 @@ static void async_callback(struct ctdb_client_control_state *state)
 	struct ctdb_context *ctdb = talloc_get_type(state->ctdb, struct ctdb_context);
 	int ret;
 	TDB_DATA outdata;
-	int32_t res;
+	int32_t res = -1;
 	uint32_t destnode = state->c->hdr.destnode;
 
 	/* one more node has responded with recmode data */
diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index 990a6b5..ba3e861 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
@@ -129,7 +129,7 @@ void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr *log_a
 		tm = localtime(&log_entries[tmp_entry].t.tv_sec);
 		strftime(tbuf, sizeof(tbuf)-1,"%Y/%m/%d %H:%M:%S", tm);
 
-		if (log_entries[tmp_entry].message) {
+		if (log_entries[tmp_entry].message[0] != '\0') {
 			fprintf(f, "%s:%s %s", tbuf,
 				get_debug_by_level(log_entries[tmp_entry].level),
 				log_entries[tmp_entry].message);
@@ -137,9 +137,17 @@ void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr *log_a
 	}
 
 	fsize = ftell(f);
+	if (fsize < 0) {
+		fclose(f);
+		DEBUG(DEBUG_ERR, ("Cannot get file size for log entries\n"));
+		return;
+	}
 	rewind(f);
 	data.dptr = talloc_size(NULL, fsize);
-	CTDB_NO_MEMORY_VOID(ctdb, data.dptr);
+	if (data.dptr == NULL) {
+		fclose(f);
+		CTDB_NO_MEMORY_VOID(ctdb, data.dptr);
+	}
 	data.dsize = fread(data.dptr, 1, fsize, f);
 	fclose(f);
 
diff --git a/common/system_linux.c b/common/system_linux.c
index 9bda6d5..ab232f0 100644
--- a/common/system_linux.c
+++ b/common/system_linux.c
@@ -75,7 +75,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
 	struct ether_header *eh;
 	struct arphdr *ah;
 	struct ip6_hdr *ip6;
-	struct icmp6_hdr *icmp6;
+	struct nd_neighbor_solicit *nd_ns;
 	struct ifreq if_hwaddr;
 	unsigned char buffer[78]; /* ipv6 neigh solicitation size */
 	char *ptr;
@@ -223,17 +223,18 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
 
 		ip6 = (struct ip6_hdr *)(eh+1);
 		ip6->ip6_vfc  = 0x60;
-		ip6->ip6_plen = htons(24);
+		ip6->ip6_plen = htons(sizeof(*nd_ns));
 		ip6->ip6_nxt  = IPPROTO_ICMPV6;
 		ip6->ip6_hlim = 255;
 		ip6->ip6_dst  = addr->ip6.sin6_addr;
 
-		icmp6 = (struct icmp6_hdr *)(ip6+1);
-		icmp6->icmp6_type = ND_NEIGHBOR_SOLICIT;
-		icmp6->icmp6_code = 0;
-		memcpy(&icmp6->icmp6_data32[1], &addr->ip6.sin6_addr, 16);
+		nd_ns = (struct nd_neighbor_solicit *)(ip6+1);
+		nd_ns->nd_ns_type = ND_NEIGHBOR_SOLICIT;
+		nd_ns->nd_ns_code = 0;
+		nd_ns->nd_ns_reserved = 0;
+		nd_ns->nd_ns_target = addr->ip6.sin6_addr;
 
-		icmp6->icmp6_cksum = tcp_checksum6((uint16_t *)icmp6, ntohs(ip6->ip6_plen), ip6);
+		nd_ns->nd_ns_cksum = tcp_checksum6((uint16_t *)nd_ns, ntohs(ip6->ip6_plen), ip6);
 
 		sall.sll_family = AF_PACKET;
 		sall.sll_halen = 6;
diff --git a/config/ctdbd_wrapper b/config/ctdbd_wrapper
index 3acc7ee..33bef06 100755
--- a/config/ctdbd_wrapper
+++ b/config/ctdbd_wrapper
@@ -182,6 +182,14 @@ start()
 	CTDB_OPTIONS="${CTDB_OPTIONS} --valgrinding"
     fi
 
+    # This is ugly but will improve when we get rid of $CTDB_OPTIONS
+    # and use only $CTDB_SYSLOG.
+    case "$CTDB_OPTIONS" in
+	*--syslog*) : ;;
+	*)
+	    logger -t ctdbd "CTDB is being run without syslog enabled.  Logs will be in ${CTDB_LOGFILE:-/var/log/log.ctdb}"
+    esac
+
     eval "$ctdbd" "$CTDB_OPTIONS" || return 1
 
     # Wait until ctdbd has started and is ready to respond to clients.
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index cc09346..0932157 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -1273,6 +1273,9 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 	fde = event_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd, 
 			   EVENT_FD_READ,
 			   ctdb_accept_client, ctdb);
+	if (fde == NULL) {
+		ctdb_fatal(ctdb, "Failed to add daemon socket to event loop");
+	}
 	tevent_fd_set_auto_close(fde);
 
 	/* release any IPs we hold from previous runs of the daemon */
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index adf1c8f..218186e 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -547,6 +547,10 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
 	/* We'll fail if stderr/stdout not already open; it's simpler. */
 	old_stdout = dup(STDOUT_FILENO);
 	old_stderr = dup(STDERR_FILENO);
+	if (old_stdout < 0 || old_stderr < 0) {
+		DEBUG(DEBUG_ERR, ("Failed to dup stdout/stderr for child logging\n"));
+		return -1;
+	}
 	if (dup2(p[1], STDOUT_FILENO) < 0 || dup2(p[1], STDERR_FILENO) < 0) {
 		int saved_errno = errno;
 		dup2(old_stdout, STDOUT_FILENO);
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index 6b27e29..57e0d68 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -1187,7 +1187,10 @@ static int ctdb_attach_persistent(struct ctdb_context *ctdb,
 		int invalid_name = 0;
 		
 		s = talloc_strdup(ctdb, de->d_name);
-		CTDB_NO_MEMORY(ctdb, s);
+		if (s == NULL) {
+			closedir(d);
+			CTDB_NO_MEMORY(ctdb, s);
+		}
 
 		/* only accept names ending in .tdb */
 		p = strstr(s, ".tdb.");
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 18b4d8e..0bec03e 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -824,7 +824,9 @@ static int delete_tdb_record(struct ctdb_context *ctdb, struct ctdb_db_context *
 
 	if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
 		if (tdb_lock_nonblock(ctdb_db->ltdb->tdb, -1, F_WRLCK) == 0) {
-			tdb_delete(ctdb_db->ltdb->tdb, key);
+			if (tdb_delete(ctdb_db->ltdb->tdb, key) != 0) {
+				DEBUG(DEBUG_CRIT,(__location__ " Failed to delete corrupt record\n"));
+			}
 			tdb_unlock(ctdb_db->ltdb->tdb, -1, F_WRLCK);
 			DEBUG(DEBUG_CRIT,(__location__ " Deleted corrupt record\n"));
 		}
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 5a6055c..bf8d8cc 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1260,8 +1260,8 @@ static int traverse_recdb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 		params->recdata = talloc_realloc_size(NULL, params->recdata, params->allocated_len);
 	}
 	if (params->recdata == NULL) {
-		DEBUG(DEBUG_CRIT,(__location__ " Failed to expand recdata to %u (%u records)\n", 
-			 rec->length + params->len, params->recdata->count));
+		DEBUG(DEBUG_CRIT,(__location__ " Failed to expand recdata to %u\n",
+			 rec->length + params->len));
 		params->failed = true;
 		return -1;
 	}
@@ -2619,8 +2619,8 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
 		return;
 	}
 
-	if (nodemap->nodes[i].flags != c->new_flags) {
-		DEBUG(DEBUG_NOTICE,("Node %u has changed flags - now 0x%x  was 0x%x\n", c->pnn, c->new_flags, nodemap->nodes[i].flags));
+	if (c->old_flags != c->new_flags) {
+		DEBUG(DEBUG_NOTICE,("Node %u has changed flags - now 0x%x  was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
 	}
 
 	disabled_flag_changed =  (nodemap->nodes[i].flags ^ c->new_flags) & NODE_FLAGS_DISABLED;
diff --git a/server/eventscript.c b/server/eventscript.c
index 1152319..10d426f 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -218,6 +218,7 @@ static struct ctdb_scripts_wire *ctdb_get_script_list(struct ctdb_context *ctdb,
 		tree_item = talloc(tree, struct ctdb_script_tree_item);
 		if (tree_item == NULL) {
 			DEBUG(DEBUG_ERR, (__location__ " Failed to allocate new tree item\n"));
+			closedir(dir);
 			talloc_free(tmp_ctx);
 			return NULL;
 		}
@@ -230,6 +231,7 @@ static struct ctdb_scripts_wire *ctdb_get_script_list(struct ctdb_context *ctdb,
 		tree_item->name = talloc_strdup(tree_item, de->d_name);
 		if (tree_item->name == NULL) {
 			DEBUG(DEBUG_ERR,(__location__ " Failed to allocate script name.\n"));
+			closedir(dir);
 			talloc_free(tmp_ctx);
 			return NULL;
 		}
@@ -880,10 +882,10 @@ int ctdb_event_script_args(struct ctdb_context *ctdb, enum ctdb_eventscript_call
 	va_start(ap, fmt);
 	ret = ctdb_event_script_callback_v(ctdb, ctdb,
 			event_script_callback, &status, false, call, fmt, ap);
+	va_end(ap);
 	if (ret != 0) {
 		return ret;
 	}
-	va_end(ap);
 
 	status.status = -1;
 	status.done = false;
diff --git a/tcp/tcp_connect.c b/tcp/tcp_connect.c
index e8cae58..383d726 100644
--- a/tcp/tcp_connect.c
+++ b/tcp/tcp_connect.c
@@ -154,6 +154,10 @@ void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
 	}
 
 	tnode->fd = socket(sock_out.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
+	if (tnode->fd == -1) {
+		DEBUG(DEBUG_ERR, (__location__ "Failed to create socket\n"));
+		return;
+	}
 	set_nonblocking(tnode->fd);
 	set_close_on_exec(tnode->fd);
 
@@ -196,7 +200,12 @@ void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
 	sock_in.ip.sin_len = sockin_size;
 	sock_out.ip.sin_len = sockout_size;
 #endif
-	bind(tnode->fd, (struct sockaddr *)&sock_in, sockin_size);
+	if (bind(tnode->fd, (struct sockaddr *)&sock_in, sockin_size) == -1) {
+		DEBUG(DEBUG_ERR, (__location__ "Failed to bind socket %s(%d)\n",
+				  strerror(errno), errno));
+		close(tnode->fd);
+		return;
+	}
 
 	if (connect(tnode->fd, (struct sockaddr *)&sock_out, sockout_size) != 0 &&
 	    errno != EINPROGRESS) {
diff --git a/tests/src/ctdb_fetch.c b/tests/src/ctdb_fetch.c
index db84f5d..b900efa 100644
--- a/tests/src/ctdb_fetch.c
+++ b/tests/src/ctdb_fetch.c
@@ -83,6 +83,11 @@ static void bench_fetch_1node(struct ctdb_context *ctdb)
 	data.dptr = (uint8_t *)talloc_asprintf_append((char *)data.dptr, 
 						      "msg_count=%d on node %d\n",
 						      msg_count, ctdb_get_pnn(ctdb));
+	if (data.dptr == NULL) {
+		printf("Failed to create record\n");
+		talloc_free(tmp_ctx);
+		return;
+	}
 	data.dsize = strlen((const char *)data.dptr)+1;
 
 	ret = ctdb_record_store(h, data);
diff --git a/tools/ctdb.c b/tools/ctdb.c
index f5a7d47..313ec3c 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -909,6 +909,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 	struct ctdb_vnn_map *vnnmap=NULL;
 	struct ctdb_node_map *nodemap=NULL;
 	uint32_t recmode, recmaster, mypnn;
+	int num_deleted_nodes = 0;
 
 	if (!ctdb_getpnn(ctdb_connection, options.pnn, &mypnn)) {
 		return -1;
@@ -931,7 +932,17 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 		return 0;
 	}
 
-	printf("Number of nodes:%d\n", nodemap->num);
+	for (i=0; i<nodemap->num; i++) {
+		if (nodemap->nodes[i].flags & NODE_FLAGS_DELETED) {
+			num_deleted_nodes++;
+		}
+	}
+	if (num_deleted_nodes == 0) {
+		printf("Number of nodes:%d\n", nodemap->num);
+	} else {
+		printf("Number of nodes:%d (including %d deleted nodes)\n",
+		       nodemap->num, num_deleted_nodes);
+	}
 	for(i=0;i<nodemap->num;i++){
 		if (nodemap->nodes[i].flags & NODE_FLAGS_DELETED) {
 			continue;
diff --git a/utils/nagios/check_ctdb b/utils/nagios/check_ctdb
index 9430333..cc0c222 100644
--- a/utils/nagios/check_ctdb
+++ b/utils/nagios/check_ctdb
@@ -178,7 +178,11 @@ if ($info eq "scriptstatus") {
             next if $. == 1; # Header
             $script_count++;
             chop;
-            my ($type, $name, $code, $status, $start, $end, @error) = split(":");
+            my ($col0, $type, $name, $code, $status, $start, $end, @error) = split(":");
+            if ($col0 ne '') {
+              # Old version, before 30 Aug 2011 and commit a779d83a6213
+              ($type, $name, $code, $status, $start, $end, @error) = ($col0, $type, $name, $code, $status, $start, $end, @error);
+            }
             my $error = join(':', @error);
             if ($error ne "") {
                 $output = "$output ;; " if $output;
diff --git a/web/samba.html b/web/samba.html
index c210f4b..fb17d0f 100644
--- a/web/samba.html
+++ b/web/samba.html
@@ -23,11 +23,8 @@ A clustered Samba install must set some specific configuration parameters
 <pre>
   clustering = yes
   idmap backend = tdb2
-  private dir = /a/directory/on/your/cluster/filesystem
 </pre>
 
-It is vital that the private directory is on shared storage. 
-
 <h2>Using smbcontrol</h2>
 
 You can check for connectivity to the smbd daemons on each node using smbcontrol
@@ -37,12 +34,9 @@ You can check for connectivity to the smbd daemons on each node using smbcontrol
 
 <h2>Using Samba4 smbtorture</h2>
 
-The Samba4 version of smbtorture has several tests that can be used to benchmark a CIFS cluster.<br>
-You can download Samba4 like this:
-<pre>
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0
-</pre>
-Then configure and compile it as usual.<br>
+The Samba4 version of smbtorture has several tests that can be used to
+benchmark a CIFS cluster. You can download Samba 4 from Samba website.
+
 The particular tests that are helpful for cluster benchmarking are the RAW-BENCH-OPEN, RAW-BENCH-LOCK and BENCH-NBENCH tests.<br>
 These tests take a unclist that allows you to spread the workload out over more than one node. For example:
 


-- 
CTDB repository


More information about the samba-cvs mailing list