Skip to contentSkip to conversation

Cluster Project branch, RHEL5, updated. cmirror_1_1_15-73-ga21d1c0

Cluster-devel [email protected] 1 participant 1 message May 15, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=a21d1c03600e011cf1ee132100ac823bf3478877

The branch, RHEL5 has been updated

       via  a21d1c03600e011cf1ee132100ac823bf3478877 (commit)
      from  607cd9680d773fff362144249328c3b6d75a4443 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit a21d1c03600e011cf1ee132100ac823bf3478877

Author: Jonathan Brassow <[email protected]>
Date:   Thu May 15 13:02:19 2008 -0500

clogd + dm-log-clustered: Improve communication error handling (K <-> U)

Connector (netlink) is an unreliable protocol. From time to time, I get a connector header in userspace that has all the right fields (seq #, size of data, etc), but the data is all zeros. When this happens, I use the seq number in the header to request the kernel to resend the request. This should avoid those nasty 'Invalid request' messages... which are then followed by 'Request timed out' (because the invalid request was ignored).

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

Summary of changes:

 cmirror-kernel/src/dm-clog-tfr.c |  124 +++++++++++++++++++++---------------
 cmirror/src/local.c              |  130 +++++++++++++++++++++++++-------------
 2 files changed, 157 insertions(+), 97 deletions(-)
cmirror-kernel/src/dm-clog-tfr.c +71 -53
index 61f6f21..7abd554 100644
@@ -62,7 +62,7 @@ static int dm_clog_sendto_server(struct clog_tfr *tfr)
 	msg->id.idx = cn_clog_id.idx;
 	msg->id.val = cn_clog_id.val;
 	msg->ack = 0;
-	msg->seq = 0;
+	msg->seq = tfr->seq;
 	msg->len = sizeof(struct clog_tfr) + tfr->data_size;
 
 	r = cn_netlink_send(msg, 0, gfp_any());
@@ -73,47 +73,67 @@ static int dm_clog_sendto_server(struct clog_tfr *tfr)
 	return r;
 }
 
-static void cn_clog_callback(void *data)
+/*
+ * fill_pkg
+ * @msg
+ * @tfr
+ *
+ * Parameters can be either msg or tfr, but not both.  This
+ * function fills in the reply for a waiting request.  If just
+ * msg is given, then the reply is simply an ACK from userspace
+ * that the request was received.
+ *
+ * Returns: 0 on success, -ENOENT on failure
+ */
+static int fill_pkg(struct cn_msg *msg, struct clog_tfr *tfr)
 {
-	int found = 0;
-	struct cn_msg *msg = (struct cn_msg *)data;
-	struct clog_tfr *tfr = (struct clog_tfr *)(msg + 1);
+	uint32_t rtn_seq = (msg) ? msg->seq : (tfr) ? tfr->seq : 0;
 	struct receiving_pkg *pkg;
 
-	spin_lock(&receiving_list_lock);
-	if (msg->len < sizeof(*tfr)) {
-		DMERR("Incomplete message received from cluster log server");
-		spin_unlock(&receiving_list_lock);
-		return;
-	}
-
 	list_for_each_entry(pkg, &receiving_list, list) {
-		/*
-		DMINFO("Msg from userspace received [%s].", RQ_TYPE(tfr->request_type));
-		DMINFO("  Seq # received: %u    Seq # wanted: %u",
-		       pkg->seq, tfr->seq);
-		*/
-		if (tfr->seq == pkg->seq) {
-			if (tfr->data_size > *(pkg->data_size)) {
-				DMERR("Insufficient space to receive package [%s]",
-				      RQ_TYPE(tfr->request_type));
-				*(pkg->data_size) = 0;
-				pkg->error = -ENOSPC;
-			} else {
-				pkg->error = tfr->error;
-				memcpy(pkg->data, tfr->data, tfr->data_size);
-				*(pkg->data_size) = tfr->data_size;
-			}
-			found = 1;
-			complete(&pkg->complete);
-			break;
+		if (rtn_seq != pkg->seq)
+			continue;
+
+		if (msg) {
+			pkg->error = -msg->ack;
+			*(pkg->data_size) = 0;
+		} else if (tfr->data_size > *(pkg->data_size)) {
+			DMERR("Insufficient space to receive package [%s]",
+			      RQ_TYPE(tfr->request_type));
+			*(pkg->data_size) = 0;
+			pkg->error = -ENOSPC;
+		} else {
+			pkg->error = tfr->error;
+			memcpy(pkg->data, tfr->data, tfr->data_size);
+			*(pkg->data_size) = tfr->data_size;
 		}
+		complete(&pkg->complete);
+		return 0;
 	}
 
+	return -ENOENT;
+}
+
+/*
+ * cn_clog_callback
+ * @data
+ *
+ * This is the connector callback that delivers data
+ * that was sent from userspace.
+ */
+static void cn_clog_callback(void *data)
+{
+	struct cn_msg *msg = (struct cn_msg *)data;
+	struct clog_tfr *tfr = (struct clog_tfr *)(msg + 1);
+
+	spin_lock(&receiving_list_lock);
+	if (msg->len == 0)
+		fill_pkg(msg, NULL);
+	else if (msg->len < sizeof(*tfr))
+		DMERR("Incomplete message received: [%u]", msg->seq);
+	else
+		fill_pkg(NULL, tfr);
 	spin_unlock(&receiving_list_lock);
-	if (!found)
-		DMERR("Stray request returned: %s, %u",
-		      RQ_TYPE(tfr->request_type), tfr->seq);
 }
 
 /*
@@ -183,37 +203,35 @@ resend:
 	if (r) {
 		DMERR("Unable to send cluster log request [%s] to server: %d",
 		      RQ_TYPE(request_type), r);
+		spin_lock(&receiving_list_lock);
+		list_del_init(&(pkg.list));
+		spin_unlock(&receiving_list_lock);
+
 		goto out;
 	}
 
 	r = wait_for_completion_timeout(&(pkg.complete), 15 * HZ);
+	spin_lock(&receiving_list_lock);
+	list_del_init(&(pkg.list));
+	spin_unlock(&receiving_list_lock);
 	if (!r) {
 		DMWARN("[%s] Request timed out: [%s/%u] - retrying",
 		       SHORT_UUID(uuid), RQ_TYPE(request_type), pkg.seq);
-		spin_lock(&receiving_list_lock);
-		list_del_init(&(pkg.list));
-		spin_unlock(&receiving_list_lock);
-
 		goto resend;
-	} else { 
-		/* FIXME: Pull time checking code - it's just for profiling */
-		pkg.start_time = (jiffies - pkg.start_time);
-		do_div(pkg.start_time, HZ);
-		if (pkg.start_time > 0)
-			DMWARN("Excessive delay in request processing, %llu sec: [%s/%u]",
-			       pkg.start_time, RQ_TYPE(request_type),
-			       pkg.seq);
 	}
+
+	/* FIXME: Pull time checking code - it's just for profiling */
+	pkg.start_time = (jiffies - pkg.start_time);
+	do_div(pkg.start_time, HZ);
+	if (pkg.start_time > 0)
+		DMWARN("Excessive delay in request processing, %llu sec: [%s/%u]",
+		       pkg.start_time, RQ_TYPE(request_type), pkg.seq);
+
 	r = pkg.error;
-	if (r)
-		DMERR("[%s] Server error while processing request [%s]: %d",
-		      SHORT_UUID(uuid), RQ_TYPE(request_type), r);
+	if (r == -EAGAIN)
+		goto resend;
 
 out:
-	spin_lock(&receiving_list_lock);
-	list_del_init(&(pkg.list));
-	spin_unlock(&receiving_list_lock);
-
 	if (tfr != (struct clog_tfr *)prealloced_clog_tfr)
 		kfree(tfr);
 
cmirror/src/local.c +84 -42

162 lines not on this page · raw message

hooks/post-receive
--
Cluster Project