Преглед на файлове

defect 629
Return error if checkpoint has been unlinked on retentation duration set

(Logical change 1.210)


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

Steven Dake преди 20 години
родител
ревизия
fbdb04b8cf
променени са 1 файла, в които са добавени 16 реда и са изтрити 11 реда
  1. 16 11
      exec/ckpt.c

+ 16 - 11
exec/ckpt.c

@@ -1505,21 +1505,26 @@ static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *m
 	struct req_exec_ckpt_checkpointretentiondurationset *req_exec_ckpt_checkpointretentiondurationset = (struct req_exec_ckpt_checkpointretentiondurationset *)message;
 	struct req_exec_ckpt_checkpointretentiondurationset *req_exec_ckpt_checkpointretentiondurationset = (struct req_exec_ckpt_checkpointretentiondurationset *)message;
 	struct res_lib_ckpt_checkpointretentiondurationset res_lib_ckpt_checkpointretentiondurationset;
 	struct res_lib_ckpt_checkpointretentiondurationset res_lib_ckpt_checkpointretentiondurationset;
 	struct saCkptCheckpoint *checkpoint;
 	struct saCkptCheckpoint *checkpoint;
+	SaAisErrorT error = SA_AIS_ERR_BAD_OPERATION;
 
 
 	checkpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_checkpointretentiondurationset->checkpointName);
 	checkpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_checkpointretentiondurationset->checkpointName);
 	if (checkpoint) {
 	if (checkpoint) {
 		log_printf (LOG_LEVEL_NOTICE, "CKPT: Setting retention duration for checkpoint %s\n",
 		log_printf (LOG_LEVEL_NOTICE, "CKPT: Setting retention duration for checkpoint %s\n",
 			getSaNameT (&req_exec_ckpt_checkpointretentiondurationset->checkpointName));
 			getSaNameT (&req_exec_ckpt_checkpointretentiondurationset->checkpointName));
-		checkpoint->checkpointCreationAttributes.retentionDuration = req_exec_ckpt_checkpointretentiondurationset->retentionDuration;
-
-		if (checkpoint->expired == 0 && checkpoint->referenceCount == 0) {
-			poll_timer_delete (aisexec_poll_handle, checkpoint->retention_timer);
-
-			poll_timer_add (aisexec_poll_handle,
-				checkpoint->checkpointCreationAttributes.retentionDuration / 1000000,
-				checkpoint,
-				timer_function_retention,
-				&checkpoint->retention_timer);
+		if (checkpoint->unlinked == 0) {
+			checkpoint->checkpointCreationAttributes.retentionDuration =
+				req_exec_ckpt_checkpointretentiondurationset->retentionDuration;
+	
+			if (checkpoint->expired == 0 && checkpoint->referenceCount == 0) {
+				poll_timer_delete (aisexec_poll_handle, checkpoint->retention_timer);
+	
+				poll_timer_add (aisexec_poll_handle,
+					checkpoint->checkpointCreationAttributes.retentionDuration / 1000000,
+					checkpoint,
+					timer_function_retention,
+					&checkpoint->retention_timer);
+			}
+			error = SA_AIS_OK;
 		}
 		}
 	}
 	}
 
 
@@ -1529,7 +1534,7 @@ static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *m
 	if (message_source_is_local(&req_exec_ckpt_checkpointretentiondurationset->source)) {
 	if (message_source_is_local(&req_exec_ckpt_checkpointretentiondurationset->source)) {
 		res_lib_ckpt_checkpointretentiondurationset.header.size = sizeof (struct res_lib_ckpt_checkpointretentiondurationset);
 		res_lib_ckpt_checkpointretentiondurationset.header.size = sizeof (struct res_lib_ckpt_checkpointretentiondurationset);
 		res_lib_ckpt_checkpointretentiondurationset.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET;
 		res_lib_ckpt_checkpointretentiondurationset.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET;
-		res_lib_ckpt_checkpointretentiondurationset.header.error = SA_AIS_OK;
+		res_lib_ckpt_checkpointretentiondurationset.header.error = error;
 
 
 		libais_send_response (req_exec_ckpt_checkpointretentiondurationset->source.conn_info,
 		libais_send_response (req_exec_ckpt_checkpointretentiondurationset->source.conn_info,
 			&res_lib_ckpt_checkpointretentiondurationset,
 			&res_lib_ckpt_checkpointretentiondurationset,