defect 998

Sometimes the default section isn't synchronized


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@864 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2005-12-20 18:48:35 +00:00
parent c4b3d9af4b
commit 6dfa2cb0ed

View File

@ -2058,7 +2058,35 @@ static int recovery_section_create (SaCkptSectionDescriptorT *sectionDescriptor,
SectionId,
(int)sectionDescriptor->sectionId.idLen);
if (ckptCheckpointSection) {
error = SA_AIS_ERR_EXIST;
/*
* This use case is mostly for the default section and is not probable for any other
* sections.
*/
if (sectionDescriptor->sectionSize
> ckptCheckpointSection->sectionDescriptor.sectionSize) {
log_printf (LOG_LEVEL_NOTICE,
"CKPT: recovery_section_create reallocating data. Present Size: %d, New Size: %d\n",
ckptCheckpointSection->sectionDescriptor.sectionSize,sectionDescriptor->sectionSize);
ckptCheckpointSection->sectionData =
realloc (ckptCheckpointSection->sectionData, sectionDescriptor->sectionSize);
if (ckptCheckpointSection->sectionData == 0) {
log_printf (LOG_LEVEL_ERROR,
"CKPT: recovery_section_create sectionData realloc returned 0 Calling error_exit.\n");
error = SA_AIS_ERR_NO_MEMORY;
checkpoint_section_release(ckptCheckpointSection);
goto error_exit;
}
ckptCheckpointSection->sectionDescriptor.sectionSize = sectionDescriptor->sectionSize;
error = SA_AIS_OK;
}
else {
error = SA_AIS_ERR_EXIST;
}
goto error_exit;
}
@ -2460,6 +2488,10 @@ static int recovery_section_write(int sectionIdLen,
*/
sizeRequired = dataOffSet + dataSize;
if (sizeRequired > ckptCheckpointSection->sectionDescriptor.sectionSize) {
log_printf (LOG_LEVEL_ERROR,
"recovery_section_write. write-past-end sizeRequired:(%d), dataOffSet:(%d), dataSize:(%d), sync-section-size:(%d)\n",
sizeRequired, dataOffSet, dataSize,
(int)ckptCheckpointSection->sectionDescriptor.sectionSize);
error = SA_AIS_ERR_ACCESS;
goto error_exit;
}