Skip to contentSkip to conversation

cluster/cmirror/src cluster.c functions.c loca ...

Cluster-devel [email protected] 1 participant 1 message Feb 4, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: jbrassow at sourceware.org 2008-02-04 18:27:20

Modified files:
cmirror/src : cluster.c functions.c local.c logging.h

Log message:
- change priority of some log statements
- fix potential OOB memory op by macro
- add reference counting to log... fixes some issues with mirror conversion
- plug a memory leak... likely related to bug 383291

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/cluster.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.11&r2=1.1.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/functions.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.10&r2=1.1.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/local.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.10&r2=1.1.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/logging.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.4&r2=1.1.2.5

cmirror/src/Attic/cluster.c +16 -15
@@ -335,7 +335,7 @@
 	}
 
 	if (rv == SA_AIS_ERR_EXIST) {
-		LOG_ERROR("export_checkpoint: checkpoint already exists");
+		LOG_DBG("export_checkpoint: checkpoint already exists");
 		EXIT();
 		return -EEXIST;
 	}
@@ -361,7 +361,7 @@
 	}
 
 	if (rv == SA_AIS_ERR_EXIST) {
-		LOG_ERROR("export_checkpoint: sync checkpoint section already exists");
+		LOG_DBG("export_checkpoint: sync checkpoint section already exists");
 		EXIT();
 		return -EEXIST;
 	}
@@ -588,8 +588,8 @@
 		}
 
 		for (cp = entry->checkpoint_list; cp;) {
-			LOG_ERROR("Checkpoint data available for node %u",
-				  cp->requester);
+			LOG_DBG("[%s] Checkpoint data available for node %u",
+				SHORT_UUID(entry->name.value), cp->requester);
 
 			/*
 			 * FIXME: Check return code.  Could send failure
@@ -747,24 +747,25 @@
 
 	ENTER();
 
-	LOG_PRINT("****** CPG config callback ****************");
+	LOG_DBG("****** CPG config callback **[%s]**",
+		SHORT_UUID(gname->value));
 
-	LOG_PRINT("* JOINING (%d):", joined_list_entries);
+	LOG_DBG("* JOINING (%d):", joined_list_entries);
 	for (i = 0; i < joined_list_entries; i++)
-		LOG_PRINT("*   nodeid: %d, pid: %d",
-			  joined_list[i].nodeid, joined_list[i].pid);
+		LOG_DBG("*   nodeid: %d, pid: %d",
+			joined_list[i].nodeid, joined_list[i].pid);
 
-	LOG_PRINT("* MEMBERS (%d):", member_list_entries);
+	LOG_DBG("* MEMBERS (%d):", member_list_entries);
 	for (i = 0; i < member_list_entries; i++)
-		LOG_PRINT("*   nodeid: %d, pid: %d",
-			  member_list[i].nodeid, member_list[i].pid);
+		LOG_DBG("*   nodeid: %d, pid: %d",
+			member_list[i].nodeid, member_list[i].pid);
 
-	LOG_PRINT("* LEAVING (%d):", left_list_entries);
+	LOG_DBG("* LEAVING (%d):", left_list_entries);
 	for (i = 0; i < left_list_entries; i++)
-		LOG_PRINT("*   nodeid: %d, pid: %d",
-			  left_list[i].nodeid, left_list[i].pid);	
+		LOG_DBG("*   nodeid: %d, pid: %d",
+			left_list[i].nodeid, left_list[i].pid);	
 
-	LOG_PRINT("*****************************************");
+	LOG_DBG("*****************************************");
 
 	list_for_each_entry_safe(match, tmp, &clog_cpg_list, list) {
 		LOG_DBG("Given handle: %llu", (unsigned long long)handle);
cmirror/src/Attic/functions.c +51 -21

147 lines not on this page · raw message

cmirror/src/Attic/local.c +15 -23
@@ -16,8 +16,6 @@
 #include "local.h"
 
 static int cn_fd;  /* Connector (netlink) socket fd */
-static int request_array[20];  /* for request counting (debugging) */
-static int cluster_array[20];  /* for request counting (debugging) */
 
 static int kernel_recv_helper(void *data, int in_size)
 {
@@ -145,7 +143,6 @@
  */
 static int do_local_work(void *data)
 {
-	static int request_count = 0;
 	int r, i;
 	struct clog_tfr *tfr = NULL;
 
@@ -154,9 +151,6 @@
 	if (r)
 		return r;
 
-	request_array[tfr->request_type]++;
-	request_count++;
-
 	LOG_DBG("Request from kernel recieved [%s/%s/%llu]",
 		RQ_TYPE(tfr->request_type), SHORT_UUID(tfr->uuid),
 		(unsigned long long)tfr->seq);
@@ -208,13 +202,22 @@
 		}
 		/* ELSE, fall through to default */
 	default:
-		cluster_array[tfr->request_type]++;
-		/* Add before send_to_cluster, so cluster code can find it */
-		queue_add_tail(tfr, cluster_queue);
 		r = cluster_send(tfr);
-		if (r)
-			LOG_ERROR("Unable to send request to cluster: %s",
-				  strerror(-r));
+		if (r) {
+			LOG_ERROR("[%s] Unable to send %s to cluster: %s",
+				  SHORT_UUID(tfr->uuid),
+				  RQ_TYPE(tfr->request_type), strerror(-r));
+			tfr->error = r;
+			kernel_send(tfr);
+		} else {
+			/*
+			 * If this was multi-threaded, we would have to
+			 * add the 'tfr' to the queue before doing
+			 * the cluster_send
+			 */
+			queue_add_tail(tfr, cluster_queue);
+		}
+
 		break;
 	}
 
@@ -223,14 +226,6 @@
 		tfr->error = r;
 	}
 
-	if (!(request_count % 10000)) {
-		LOG_PRINT("Total requests (%d):", request_count);
-		for (i = 0; i < 20; i++)
-			LOG_PRINT("  %s: %d", RQ_TYPE(i), request_array[i]);
-		LOG_PRINT("Cluster-bound requests:");
-		for (i = 0; i < 20; i++)
-			LOG_PRINT("  %s: %d", RQ_TYPE(i), cluster_array[i]);
-	}
 	EXIT();
 	return r;
 }
@@ -303,9 +298,6 @@
 
 	ENTER();
 
-	memset(request_array, 0, sizeof(int)*20);
-	memset(cluster_array, 0, sizeof(int)*20);
-
 	cn_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
 	if (cn_fd < 0) {
 		EXIT();
cmirror/src/Attic/logging.h +1 -1
@@ -29,7 +29,7 @@
 #endif
 
 /* SHORT_UUID - print last 8 chars of a string */
-#define SHORT_UUID(x) ((x) + (strlen(x) - 8))
+#define SHORT_UUID(x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x)
 
 extern int log_tabbing;
 extern int log_is_open;