[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/cmirror/src cluster.c functions.c local.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	jbrassow sourceware org	2008-02-05 22:12:54

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

Log message:
	- allocate additional transfer struct when necessary
	- fix ordering of clustered_disk table output
	- respond to get_sync_count requests when suspended (as required by mirror)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/cluster.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.12&r2=1.1.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/functions.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/local.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.11&r2=1.1.2.12

--- cluster/cmirror/src/Attic/cluster.c	2008/02/04 18:27:20	1.1.2.12
+++ cluster/cmirror/src/Attic/cluster.c	2008/02/05 22:12:54	1.1.2.13
@@ -197,9 +197,26 @@
 	orig_tfr = queue_remove_match(cluster_queue, clog_tfr_cmp, tfr);
 
 	if (!orig_tfr) {
+		struct list_head l, *p, *n;
+		struct clog_tfr *t;
+
 		/* Unable to find match for response */
-		LOG_ERROR("No match for cluster response: %s/%s",
-			  RQ_TYPE(tfr->request_type), tfr->uuid);
+
+		LOG_ERROR("[%s] No match for cluster response: %s:%llu",
+			  SHORT_UUID(tfr->uuid), RQ_TYPE(tfr->request_type),
+			  (unsigned long long)tfr->seq);
+
+		queue_remove_all(&l, cluster_queue);
+		LOG_ERROR("Current list:");
+		list_for_each_safe(p, n, &l) {
+			list_del_init(p);
+			t = (struct clog_tfr *)p;
+			LOG_ERROR("[%s]  %s:%llu", SHORT_UUID(t->uuid),
+				  RQ_TYPE(t->request_type),
+				  (unsigned long long)t->seq);
+			queue_add(t, cluster_queue);
+		}
+
 		r = -EINVAL;
 		goto out;
 	}
@@ -405,8 +422,12 @@
 
 	tfr = queue_remove(free_queue);
 	if (!tfr) {
-		LOG_ERROR("No clog_tfr struct available");
-		return -ENOMEM;
+		LOG_PRINT("export_checkpoint: Preallocated transfer structs exhausted");
+		tfr = malloc(DM_CLOG_TFR_SIZE);
+		if (!tfr) {
+			LOG_ERROR("export_checkpoint: Unable to allocate transfer structs");
+			return -ENOMEM;
+		}
 	}
 	memset(tfr, 0, sizeof(*tfr));
 	tfr->request_type = DM_CLOG_CHECKPOINT_READY;
@@ -715,9 +736,15 @@
 			LOG_DBG("Log not valid yet, storing request");
 			startup_tfr = queue_remove(free_queue);
 			if (!startup_tfr) {
-				LOG_ERROR("Supply of transfer structs exhausted");
-				r = -ENOMEM; /* FIXME: Better error #? */
-				goto out;
+				LOG_PRINT("cpg_message_callback:  Preallocated"
+					  " transfer structs exhausted");
+				startup_tfr = malloc(DM_CLOG_TFR_SIZE);
+				if (!startup_tfr) {
+					LOG_ERROR("cpg_message_callback:  Unable to"
+						  " allocate transfer structs");
+					r = -ENOMEM; /* FIXME: Better error #? */
+					goto out;
+				}
 			}
 
 			memcpy(startup_tfr, tfr, sizeof(*tfr) + tfr->data_size);
@@ -847,7 +874,7 @@
 					exit(1);
 				}
 				my_cluster_id = joined_list[i].nodeid;
-				LOG_PRINT("Setting my cluster id: %u", my_cluster_id);
+				LOG_DBG("Setting my cluster id: %u", my_cluster_id);
 			}
 		}
 	}
--- cluster/cmirror/src/Attic/functions.c	2008/02/04 18:27:20	1.1.2.11
+++ cluster/cmirror/src/Attic/functions.c	2008/02/05 22:12:54	1.1.2.12
@@ -1209,6 +1209,15 @@
 	uint64_t *sync_count = (uint64_t *)tfr->data;
 	struct log_c *lc = get_log(tfr->uuid);
 
+	/*
+	 * FIXME: Mirror requires us to be able to ask for
+	 * the sync count while pending... but I don't like
+	 * it because other machines may not be suspended and
+	 * the stored value may not be accurate.
+	 */
+	if (!lc)
+		lc = get_pending_log(tfr->uuid);
+
 	if (!lc)
 		return -EINVAL;
 
@@ -1294,10 +1303,9 @@
 	}
 
 	params = (lc->sync == DEFAULTSYNC) ? 4 : 5;
-	tfr->data_size = sprintf(data, "clustered_disk %d %u %d:%d %s %sblock_on_error ",
-				 params, lc->region_size,
-				 major(statbuf.st_rdev), minor(statbuf.st_rdev),
-				 lc->uuid,
+	tfr->data_size = sprintf(data, "clustered_disk %d %d:%d %u %s %sblock_on_error ",
+				 params, major(statbuf.st_rdev), minor(statbuf.st_rdev),
+				 lc->region_size, lc->uuid,
 				 (lc->sync == DEFAULTSYNC) ? "" :
 				 (lc->sync == NOSYNC) ? "nosync " : "sync ");
 	return 0;
--- cluster/cmirror/src/Attic/local.c	2008/02/04 18:27:20	1.1.2.11
+++ cluster/cmirror/src/Attic/local.c	2008/02/05 22:12:54	1.1.2.12
@@ -80,8 +80,12 @@
 	 * The kernel must retry
 	 */
 	if (!(*tfr = queue_remove(free_queue))) {
-		LOG_ERROR("Failed to get clog_tfr from free_queue");
-		return -ENOMEM;
+		LOG_PRINT("kernel_recv:  Preallocated transfer structs exhausted");
+		*tfr = malloc(DM_CLOG_TFR_SIZE);
+		if (!*tfr) {
+			LOG_ERROR("kernel_recv:  Unable to allocate transfer struct");
+			return -ENOMEM;
+		}
 	}
 
 	memset(*tfr, 0, DM_CLOG_TFR_SIZE);
@@ -143,7 +147,7 @@
  */
 static int do_local_work(void *data)
 {
-	int r, i;
+	int r;
 	struct clog_tfr *tfr = NULL;
 
 	ENTER();
@@ -158,6 +162,7 @@
 	case DM_CLOG_CTR:
 	case DM_CLOG_DTR:
 	case DM_CLOG_IN_SYNC:
+	case DM_CLOG_GET_SYNC_COUNT:
 	case DM_CLOG_STATUS_INFO:
 	case DM_CLOG_STATUS_TABLE:
 	case DM_CLOG_PRESUSPEND:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]