瀏覽代碼

defect 743
in saCkptCheckpointSectionCreate return SA_AIS_ERR_NO_SPACE if
current sections == maxSections


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

Steven Dake 20 年之前
父節點
當前提交
53c69c8d84
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 10 0
      exec/ckpt.c
  2. 1 0
      exec/ckpt.h

+ 10 - 0
exec/ckpt.c

@@ -1224,6 +1224,7 @@ void checkpoint_release (struct saCkptCheckpoint *checkpoint)
 			struct saCkptCheckpointSection, list);
 	
 		list = list->next;
+		checkpoint->sectionCount -= 1;
 		checkpoint_section_release (section);
 	}
 	list_del (&checkpoint->list);
@@ -1368,6 +1369,7 @@ static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct i
 		ckptCheckpoint->referenceCount = 0;
 		ckptCheckpoint->retention_timer = 0;
 		ckptCheckpoint->expired = 0;
+		ckptCheckpoint->sectionCount = 0;
 		
 		if ((ckptCheckpoint->checkpointCreationAttributes.creationFlags & (SA_CKPT_WR_ACTIVE_REPLICA | SA_CKPT_WR_ACTIVE_REPLICA_WEAK)) &&
 			(ckptCheckpoint->checkpointCreationAttributes.creationFlags & SA_CKPT_CHECKPOINT_COLLOCATED) == 0) {
@@ -1747,6 +1749,7 @@ void timer_function_section_expire (void *data)
                         ckpt_id->ckpt_section_id.id,
                         (char *)&ckpt_id->ckpt_name.value);
 
+	ckptCheckpoint->sectionCount -= 1;
 	checkpoint_section_release (ckptCheckpointSection);
 free_mem :
 	free (ckpt_id);
@@ -2092,6 +2095,11 @@ static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in
 		goto error_exit;
 	}
 
+	if (ckptCheckpoint->sectionCount == ckptCheckpoint->checkpointCreationAttributes.maxSections) {
+		error = SA_AIS_ERR_NO_SPACE;
+		goto error_exit;
+	}
+
 	/*
 	 * Determine if user-specified checkpoint ID already exists
 	 */
@@ -2181,6 +2189,7 @@ static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in
 	list_init (&ckptCheckpointSection->list);
 	list_add (&ckptCheckpointSection->list,
 		&ckptCheckpoint->checkpointSectionsListHead);
+	ckptCheckpoint->sectionCount += 1;
 
 error_exit:
 	if (message_source_is_local(&req_exec_ckpt_sectioncreate->source)) {
@@ -2237,6 +2246,7 @@ static int message_handler_req_exec_ckpt_sectiondelete (void *message, struct in
 	/*
 	 * Delete checkpoint section
 	 */
+	ckptCheckpoint->sectionCount -= 1;
 	checkpoint_section_release (ckptCheckpointSection);
 
 	/*

+ 1 - 0
exec/ckpt.h

@@ -61,6 +61,7 @@ struct saCkptCheckpoint {
 	poll_timer_handle retention_timer;
 	int expired;
 	int active_replica_set;
+	int sectionCount;
 	struct ckpt_refcnt ckpt_refcount[PROCESSOR_COUNT_MAX];	
 };