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

Fix defect 974
There was an infinite loop problem in the fix for defect 974


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

Steven Dake 20 лет назад
Родитель
Сommit
67fd2189d6
1 измененных файлов с 7 добавлено и 6 удалено
  1. 7 6
      exec/ckpt.c

+ 7 - 6
exec/ckpt.c

@@ -1022,19 +1022,19 @@ static void ckpt_recovery_process_members_exit(struct in_addr *left_list,
 	 */
 	member = left_list;
 	for (i = 0; i < left_list_entries; i++) {		
-		for (checkpoint_list = checkpoint_list_head.next;
-			checkpoint_list != &checkpoint_list_head;
-			checkpoint_list = checkpoint_list->next) {
+		checkpoint_list = checkpoint_list_head.next;
 
+iterate_while_loop:
+		while (checkpoint_list != &checkpoint_list_head) {
 			checkpoint = list_entry (checkpoint_list,
 				struct saCkptCheckpoint, list);			
 			assert (checkpoint > 0);
-			index = processor_index_find(member, checkpoint->ckpt_refcount);			
+			index = processor_index_find(member, checkpoint->ckpt_refcount);
+			assert (-1 <= index < PROCESSOR_COUNT_MAX);			
 			if (index < 0) {
 				checkpoint_list = checkpoint_list->next;
-				continue;
+				goto iterate_while_loop;
 			}		
-			assert ( index < PROCESSOR_COUNT_MAX);
 			/*
 			 * Decrement
 			 * 
@@ -1051,6 +1051,7 @@ static void ckpt_recovery_process_members_exit(struct in_addr *left_list,
 			}		
 			checkpoint->ckpt_refcount[index].count = 0;
 			memset((char*)&checkpoint->ckpt_refcount[index].addr, 0, sizeof(struct in_addr));			
+			checkpoint_list = checkpoint_list->next;
 		}
 		member++;
 	}