Second version of patch. It tests if we should deliver message inside of
cpd cycle. It fixes problem, where restarted node can get message from
(for that node) unknown node.

Regards,
  Honza

Steven Dake wrote:
> Honzaf,
> 
> Does this patch fix a specific test case?
> 
> Regards
> -steve
> 
> On Thu, 2009-06-25 at 16:55 +0200, Jan Friesse wrote:
>> Currently, messages are delivered to application without testing, if we
>> know the node (this means, we have no process info about from that node).
>>
>> Following patch fixes that.
>> _______________________________________________
>> Openais mailing list
>> [email protected]
>> https://lists.linux-foundation.org/mailman/listinfo/openais
> 

diff --git a/trunk/services/cpg.c b/trunk/services/cpg.c
index 5c93586..93e58ef 100644
--- a/trunk/services/cpg.c
+++ b/trunk/services/cpg.c
@@ -822,9 +917,10 @@ static void message_handler_req_exec_cpg_mcast (
 	const struct req_exec_cpg_mcast *req_exec_cpg_mcast = message;
 	struct res_lib_cpg_deliver_callback res_lib_cpg_mcast;
 	int msglen = req_exec_cpg_mcast->msglen;
-	struct list_head *iter;
+	struct list_head *iter, *pi_iter;
 	struct cpg_pd *cpd;
 	struct iovec iovec[2];
+	int known_node = 0;
 
 	res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_DELIVER_CALLBACK;
 	res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast) + msglen;
@@ -846,6 +942,27 @@ static void message_handler_req_exec_cpg_mcast (
 
 		if ((cpd->cpd_state == CPD_STATE_LEAVE_STARTED || cpd->cpd_state == CPD_STATE_JOIN_COMPLETED)
 			&& (mar_name_compare (&cpd->group_name, &req_exec_cpg_mcast->group_name) == 0)) {
+
+			if (!known_node) {
+				/* Try to find, if we know the node */
+				for (pi_iter = process_info_list_head.next;
+					pi_iter != &process_info_list_head; pi_iter = pi_iter->next) {
+
+					struct process_info *pi = list_entry (pi_iter, struct process_info, list);
+
+					if (pi->nodeid == nodeid &&
+						mar_name_compare (&pi->group, &req_exec_cpg_mcast->group_name) == 0) {
+						known_node = 1;
+						break;
+					}
+				}
+			}
+
+			if (!known_node) {
+				/* Unknown node -> we will not deliver message */
+				return ;
+			}
+
 			api->ipc_dispatch_iov_send (cpd->conn, iovec, 2);
 		}
 	}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to