linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Patch to clvmd-openais.c again
@ 2008-04-25 10:11 Xinwei Hu
  2008-04-25 10:12 ` [linux-lvm] " Xinwei Hu
  0 siblings, 1 reply; 5+ messages in thread
From: Xinwei Hu @ 2008-04-25 10:11 UTC (permalink / raw)
  To: LVM general discussion and development

Hi all,

  The attached patch is a try to make clvmd work correctly on openais stack.
It does 2 things.

1. The cpg_deliver_callback make a compare between target_nodeid and our_nodeid.
It turns out openais set target_nodeid to 0 sometimes. for
broadcasting ? I change
the behavior so that lvm will process_remote also on target_nodeid == 0

2. The joined_list passed to cpg_confchg_callback doesn't include the
already exist
nodes in the group, which leads to an incomplete node_hash. I simply
add all other
nodes in member_list to node_hash also.

  With this patch applied, clvmd works correctly with basic lvm commands now.

  Please kindly review this, and consider it for upstream.

  Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [linux-lvm] Re: Patch to clvmd-openais.c again
  2008-04-25 10:11 [linux-lvm] Patch to clvmd-openais.c again Xinwei Hu
@ 2008-04-25 10:12 ` Xinwei Hu
  2008-04-28  8:57   ` Christine Caulfield
  0 siblings, 1 reply; 5+ messages in thread
From: Xinwei Hu @ 2008-04-25 10:12 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

Sorry, stupid thing happens ;)

2008/4/25, Xinwei Hu <hxinwei@gmail.com>:
> Hi all,
>
>   The attached patch is a try to make clvmd work correctly on openais stack.
>  It does 2 things.
>
>  1. The cpg_deliver_callback make a compare between target_nodeid and our_nodeid.
>  It turns out openais set target_nodeid to 0 sometimes. for
>  broadcasting ? I change
>  the behavior so that lvm will process_remote also on target_nodeid == 0
>
>  2. The joined_list passed to cpg_confchg_callback doesn't include the
>  already exist
>  nodes in the group, which leads to an incomplete node_hash. I simply
>  add all other
>  nodes in member_list to node_hash also.
>
>   With this patch applied, clvmd works correctly with basic lvm commands now.
>
>   Please kindly review this, and consider it for upstream.
>
>   Thanks.
>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: upstream.diff --]
[-- Type: text/x-patch; name=upstream.diff, Size: 1830 bytes --]

--- clvmd-openais.c.orig	2008-04-25 17:55:56.000000000 +0800
+++ clvmd-openais.c.new	2008-04-25 18:03:10.000000000 +0800
@@ -245,12 +245,13 @@
 
 	memcpy(&target_nodeid, msg, OPENAIS_CSID_LEN);
 
-	DEBUGLOG("Got message from nodeid %d for %d. len %d\n",
-		 nodeid, target_nodeid, msg_len-4);
+	DEBUGLOG("%u got message from nodeid %d for %d. len %d\n",
+		 our_nodeid, nodeid, target_nodeid, msg_len-4);
 
-	if (target_nodeid == our_nodeid)
-		process_message(cluster_client, (char *)msg+OPENAIS_CSID_LEN,
-				msg_len-OPENAIS_CSID_LEN, (char*)&nodeid);
+	if (nodeid != our_nodeid)
+		if (target_nodeid == our_nodeid || target_node == 0)
+			process_message(cluster_client, (char *)msg+OPENAIS_CSID_LEN,
+					msg_len-OPENAIS_CSID_LEN, (char*)&nodeid);
 }
 
 static void cpg_confchg_callback(cpg_handle_t handle,
@@ -292,7 +293,43 @@
 			ninfo->state = NODE_DOWN;
 	}
 
+	for (i=0; i<member_list_entries; i++) {
+		if (member_list[i].nodeid == 0) continue;
+		ninfo = dm_hash_lookup_binary(node_hash,
+				(char *)&member_list[i].nodeid,
+				OPENAIS_CSID_LEN);
+		if (!ninfo) {
+			ninfo = malloc(sizeof(struct node_info));
+			if (!ninfo) {
+				break;
+			}
+			else {
+				ninfo->nodeid = member_list[i].nodeid;
+				dm_hash_insert_binary(node_hash,
+						(char *)&ninfo->nodeid,
+						OPENAIS_CSID_LEN, ninfo);
+			}
+		}
+		ninfo->state = NODE_CLVMD;
+	}
+
 	num_nodes = joined_list_entries;
+
+	//Verbose on node_hash, helpful to debug
+	struct dm_hash_node *hn;
+	DEBUGLOG("Iterate node_hash\n");
+	dm_hash_iterate(hn, node_hash)
+	{
+		ninfo = dm_hash_get_data(node_hash, hn);
+		if (ninfo->state == NODE_CLVMD) {
+			DEBUGLOG("%u:%s\n", ninfo->nodeid, "CLVMD");
+		}
+		else {
+			if (ninfo->state == NODE_DOWN)
+				DEBUGLOG("%u:%s\n", ninfo->nodeid, "DOWN");
+		}
+	}
+	DEBUGLOG("Iterate node_hash done\n");
 }
 
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Re: Patch to clvmd-openais.c again
  2008-04-25 10:12 ` [linux-lvm] " Xinwei Hu
@ 2008-04-28  8:57   ` Christine Caulfield
  2008-04-28 16:27     ` Xinwei Hu
  0 siblings, 1 reply; 5+ messages in thread
From: Christine Caulfield @ 2008-04-28  8:57 UTC (permalink / raw)
  To: LVM general discussion and development

Xinwei Hu wrote:
> Sorry, stupid thing happens ;)
> 
> 2008/4/25, Xinwei Hu <hxinwei@gmail.com>:
>> Hi all,
>>
>>   The attached patch is a try to make clvmd work correctly on openais stack.
>>  It does 2 things.
>>
>>  1. The cpg_deliver_callback make a compare between target_nodeid and our_nodeid.
>>  It turns out openais set target_nodeid to 0 sometimes. for
>>  broadcasting ? I change
>>  the behavior so that lvm will process_remote also on target_nodeid == 0
>>
>>  2. The joined_list passed to cpg_confchg_callback doesn't include the
>>  already exist
>>  nodes in the group, which leads to an incomplete node_hash. I simply
>>  add all other
>>  nodes in member_list to node_hash also.
>>
>>   With this patch applied, clvmd works correctly with basic lvm commands now.
>>
>>   Please kindly review this, and consider it for upstream.
>>

Your patch has now been included in upstream clvmd.

Thank you.

-- 

Chrissie

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Re: Patch to clvmd-openais.c again
  2008-04-28  8:57   ` Christine Caulfield
@ 2008-04-28 16:27     ` Xinwei Hu
  2008-04-29  8:55       ` Christine Caulfield
  0 siblings, 1 reply; 5+ messages in thread
From: Xinwei Hu @ 2008-04-28 16:27 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

> Your patch has now been included in upstream clvmd.

Thanks for the inclusion.

And here are another 2:
. remove_lock_wait.diff remove the definition of "struct lock_wait",
which is not used since the switch away from async version saLck
. num_nodes should equal to member_list_entries, i.e.
joined_list_entires is 0 when a node leaves the group.

Would you help review them ;)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: remove_lock_wait.diff --]
[-- Type: text/x-patch; name=remove_lock_wait.diff, Size: 391 bytes --]

--- clvmd-openais.c.orig	2008-04-28 21:53:46.000000000 +0800
+++ clvmd-openais.c	2008-04-28 21:53:53.000000000 +0800
@@ -100,13 +100,6 @@
 	SaNameT              lock_name;
 };
 
-struct lock_wait
-{
-	pthread_cond_t cond;
-	pthread_mutex_t mutex;
-	int status;
-};
-
 /* Set errno to something approximating the right value and return 0 or -1 */
 static int ais_to_errno(SaAisErrorT err)
 {

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: num_nodes_fix.diff --]
[-- Type: text/x-patch; name=num_nodes_fix.diff, Size: 322 bytes --]

--- clvmd-openais.c.orig	2008-04-28 21:53:53.000000000 +0800
+++ clvmd-openais.c	2008-04-28 22:03:05.000000000 +0800
@@ -306,7 +306,7 @@
 		ninfo->state = NODE_CLVMD;
 	}
 
-	num_nodes = joined_list_entries;
+	num_nodes = member_list_entries;
 }
 
 static int lck_dispatch(struct local_client *client, char *buf, int len,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] Re: Patch to clvmd-openais.c again
  2008-04-28 16:27     ` Xinwei Hu
@ 2008-04-29  8:55       ` Christine Caulfield
  0 siblings, 0 replies; 5+ messages in thread
From: Christine Caulfield @ 2008-04-29  8:55 UTC (permalink / raw)
  To: LVM general discussion and development

Xinwei Hu wrote:
>> Your patch has now been included in upstream clvmd.
> 
> Thanks for the inclusion.
> 
> And here are another 2:
> . remove_lock_wait.diff remove the definition of "struct lock_wait",
> which is not used since the switch away from async version saLck
> . num_nodes should equal to member_list_entries, i.e.
> joined_list_entires is 0 when a node leaves the group.
> 
> Would you help review them ;)

Those patches also look good. They are now in CVS.

Thanks!

Chrissie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-29  8:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 10:11 [linux-lvm] Patch to clvmd-openais.c again Xinwei Hu
2008-04-25 10:12 ` [linux-lvm] " Xinwei Hu
2008-04-28  8:57   ` Christine Caulfield
2008-04-28 16:27     ` Xinwei Hu
2008-04-29  8:55       ` Christine Caulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).