Просмотр исходного кода

defect 1024
YKD algorithm doesn't always work when new_message_queue is full.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@885 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
a4538aee95
4 измененных файлов с 43 добавлено и 12 удалено
  1. 2 5
      exec/totempg.c
  2. 3 0
      exec/totemrrp.c
  3. 2 3
      exec/totemsrp.c
  4. 36 4
      exec/ykd.c

+ 2 - 5
exec/totempg.c

@@ -948,10 +948,8 @@ int totempg_groups_mcast_joined (
 		iovec_mcast[i + instance->groups_cnt + 1].iov_base = iovec[i].iov_base;
 		iovec_mcast[i + instance->groups_cnt + 1].iov_base = iovec[i].iov_base;
 	}
 	}
 
 
-	mcast_msg (iovec_mcast, iov_len + instance->groups_cnt + 1, guarantee);
-
+	error = mcast_msg (iovec_mcast, iov_len + instance->groups_cnt + 1, guarantee);
 	saHandleInstancePut (&totempg_groups_instance_database, handle);
 	saHandleInstancePut (&totempg_groups_instance_database, handle);
-	return (0);
 
 
 error_exit:
 error_exit:
 	return (error);
 	return (error);
@@ -1026,10 +1024,9 @@ int totempg_groups_mcast_groups (
 		iovec_mcast[i + groups_cnt + 1].iov_base = iovec[i].iov_base;
 		iovec_mcast[i + groups_cnt + 1].iov_base = iovec[i].iov_base;
 	}
 	}
 
 
-	mcast_msg (iovec_mcast, iov_len + groups_cnt + 1, guarantee);
+	error = mcast_msg (iovec_mcast, iov_len + groups_cnt + 1, guarantee);
 
 
 	saHandleInstancePut (&totempg_groups_instance_database, handle);
 	saHandleInstancePut (&totempg_groups_instance_database, handle);
-	return (0);
 
 
 error_exit:
 error_exit:
 	return (error);
 	return (error);

+ 3 - 0
exec/totemrrp.c

@@ -811,6 +811,7 @@ int totemrrp_mcast_flush_send (
 		goto error_exit;
 		goto error_exit;
 	}
 	}
 	
 	
+// TODO this needs to return the result
 	instance->rrp_algo->mcast_flush_send (instance, msg, msg_len);
 	instance->rrp_algo->mcast_flush_send (instance, msg, msg_len);
 
 
 	saHandleInstancePut (&totemrrp_instance_database, handle);
 	saHandleInstancePut (&totemrrp_instance_database, handle);
@@ -840,6 +841,8 @@ int totemrrp_mcast_noflush_send (
 	 * an encryption/hmac and decryption/hmac
 	 * an encryption/hmac and decryption/hmac
 	 */
 	 */
 	if (instance->processor_count > 1) {
 	if (instance->processor_count > 1) {
+
+// TODO this needs to return the result
 		instance->rrp_algo->mcast_noflush_send (instance, iovec, iov_len);
 		instance->rrp_algo->mcast_noflush_send (instance, iovec, iov_len);
 	}
 	}
 
 

+ 2 - 3
exec/totemsrp.c

@@ -1709,6 +1709,7 @@ int totemsrp_mcast (
 	}
 	}
 	
 	
 	if (queue_is_full (&instance->new_message_queue)) {
 	if (queue_is_full (&instance->new_message_queue)) {
+printf ("queue full\n");
 		return (-1);
 		return (-1);
 	}
 	}
 	for (j = 0, i = 0; i < iov_len; i++) {
 	for (j = 0, i = 0; i < iov_len; i++) {
@@ -1761,17 +1762,15 @@ int totemsrp_mcast (
 	return (0);
 	return (0);
 
 
 error_iovec:
 error_iovec:
-	saHandleInstancePut (&totemsrp_instance_database, handle);
 	for (j = 0; j < i; j++) {
 	for (j = 0; j < i; j++) {
 		free (message_item.iovec[j].iov_base);
 		free (message_item.iovec[j].iov_base);
 	}
 	}
-	return (-1);
 
 
 error_mcast:
 error_mcast:
 	saHandleInstancePut (&totemsrp_instance_database, handle);
 	saHandleInstancePut (&totemsrp_instance_database, handle);
 
 
 error_exit:
 error_exit:
-	return (0);
+	return (-1);
 }
 }
 
 
 /*
 /*

+ 36 - 4
exec/ykd.c

@@ -132,6 +132,10 @@ static int primary_designated = 0;
 
 
 static struct memb_ring_id ykd_ring_id;
 static struct memb_ring_id ykd_ring_id;
 
 
+static void *ykd_attempt_send_callback_token_handle = 0;
+
+static void *ykd_state_send_callback_token_handle = 0;
+
 static void (*ykd_primary_callback_fn) (
 static void (*ykd_primary_callback_fn) (
 	struct totem_ip_address *view_list,
 	struct totem_ip_address *view_list,
 	int view_list_entries,
 	int view_list_entries,
@@ -147,10 +151,11 @@ void ykd_state_init (void)
 	ykd_state.last_primary.member_list_entries = 0;
 	ykd_state.last_primary.member_list_entries = 0;
 }
 }
 
 
-void ykd_state_send (void)
+int ykd_state_send_msg (enum totem_callback_token_type type, void *context)
 {
 {
 	struct iovec iovec[2];
 	struct iovec iovec[2];
 	struct ykd_header header;
 	struct ykd_header header;
+	int res;
 
 
 	header.id = YKD_HEADER_SENDSTATE;
 	header.id = YKD_HEADER_SENDSTATE;
 	
 	
@@ -159,20 +164,47 @@ void ykd_state_send (void)
 	iovec[1].iov_base = &ykd_state;
 	iovec[1].iov_base = &ykd_state;
 	iovec[1].iov_len = sizeof (struct ykd_state);
 	iovec[1].iov_len = sizeof (struct ykd_state);
 
 
-	totempg_groups_mcast_joined (ykd_group_handle, iovec, 2, TOTEMPG_AGREED);
+	res = totempg_groups_mcast_joined (ykd_group_handle, iovec, 2,
+		TOTEMPG_AGREED);
+
+	return (res);
 }
 }
 
 
-void ykd_attempt_send (void)
+void ykd_state_send (void)
+{
+        totempg_callback_token_create (
+                &ykd_state_send_callback_token_handle,
+                TOTEM_CALLBACK_TOKEN_SENT,
+                1, /* delete after callback */
+                ykd_state_send_msg,
+                NULL);
+}
+
+int ykd_attempt_send_msg (enum totem_callback_token_type type, void *context)
 {
 {
 	struct iovec iovec;
 	struct iovec iovec;
 	struct ykd_header header;
 	struct ykd_header header;
+	int res;
 
 
 	header.id = YKD_HEADER_SENDSTATE;
 	header.id = YKD_HEADER_SENDSTATE;
 	
 	
 	iovec.iov_base = &header;
 	iovec.iov_base = &header;
 	iovec.iov_len = sizeof (struct ykd_header);
 	iovec.iov_len = sizeof (struct ykd_header);
 
 
-	totempg_groups_mcast_joined (ykd_group_handle, &iovec, 1, TOTEMPG_AGREED);
+	res = totempg_groups_mcast_joined (ykd_group_handle, &iovec, 1,
+		TOTEMPG_AGREED);
+
+	return (res);
+}
+
+void ykd_attempt_send (void)
+{
+        totempg_callback_token_create (
+                &ykd_attempt_send_callback_token_handle,
+                TOTEM_CALLBACK_TOKEN_SENT,
+                1, /* delete after callback */
+                ykd_attempt_send_msg,
+                NULL);
 }
 }
 
 
 void compute (void)
 void compute (void)