[PATCH 1/4] Really clear totemconfig nodes on reload

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

 



When reload was called nodes were constantly added to totemconfig
nodelist.

So simple corosync-cfgtool -R resulted very quickly in filling whole
array and segfault.

Solution is to clear member_count.

Clearing is also moved directly to put_nodelist_members_to_config to
make sure it's always processed.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/totemconfig.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index 7180646..0fa9777 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -349,6 +349,15 @@ static void put_nodelist_members_to_config(struct totem_config *totem_config)
 	char *node_addr_str;
 	int member_count;
 	unsigned int ringnumber = 0;
+	int i, j;
+
+	/* Clear out nodelist so we can put the new one in if needed */
+	for (i = 0; i < totem_config->interface_count; i++) {
+		for (j = 0; j < PROCESSOR_COUNT_MAX; j++) {
+			memset(&totem_config->interfaces[i].member_list[j], 0, sizeof(struct totem_ip_address));
+		}
+		totem_config->interfaces[i].member_count = 0;
+	}
 
 	iter = icmap_iter_init("nodelist.node.");
 	while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
@@ -1209,15 +1218,6 @@ static void totem_reload_notify(
 
 	/* Reload has completed */
 	if (*(uint8_t *)new_val.data == 0) {
-		int i, j;
-
-		/* Clear out udpu nodelist so we can put the new one in if neede */
-		for (i=0; i<totem_config->interface_count; i++) {
-			for (j=0; j<PROCESSOR_COUNT_MAX; j++) {
-				memset(&totem_config->interfaces[i].member_list[j], 0, sizeof(struct totem_ip_address));
-			}
-		}
-
 		put_nodelist_members_to_config (totem_config);
 		totem_volatile_config_read (totem_config);
 
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux