--- ./source/private_module/enterprise/event/rephc_cg_event.c	2018-04-27 10:16:51.000000000 +0000
+++ ./source/private_module/enterprise/event/rephc_cg_event.c.hotpatch	2019-03-20 08:28:44.000000000 +0000
@@ -1714,17 +1714,17 @@
     uint64_t domianId;
     REPHC_EVENT_S* event = NULL;
     char *eventName = "--";
+    uint64_t cgId = INVALID_VALUE64;
+    uint32_t lockBitFlag = INVALID_VALUE32;
     event   = (REPHC_EVENT_S *)context;    
- 
     eventName = getCgEventCodeNameRephc(event->eventCode);
     event->rmtCgId = getRemoteCgIdCfg(event->localCgId);
     event->dsType = getCgDsTypeCfg(event->localCgId);
-    /* ǷڼȺһڼȺִ */
+    cgId = event->cgId;
+    lockBitFlag = event->lockBitFlag;
     if (!isThisMasterController())
     {
-        DBG_LogError(REPHC_LOG_ID_NEW,
-                     "It is not master, (localId %u, eventcode %u(%s)).", 
-                     event->localCgId, event->eventCode, eventName);
+        DBG_LogError(REPHC_LOG_ID_NEW,"It is not master, (localId %u, eventcode %u(%s)).", event->localCgId, event->eventCode, eventName);
         freeLocalCgObjs(event->cgId, &event->lockBitFlag);
         freeEventAndCallback(event, event->callback, event->context,RETURN_REPHC_SYS_BUSY);
         return ;
@@ -1748,7 +1748,7 @@
     if (TRUE == isSendToRemote)
     {
         sendRepHcCgEvtToRmt(event, remoteArrayId);
-        freeLocalCgObjs(event->cgId, &event->lockBitFlag);
+        freeLocalCgObjs(cgId, &lockBitFlag);
         return;
     }
     /*DTS2016022201175 start taskе¼ȴ*/
--- ./source/private_module/enterprise/event/rephc_event.c	2018-04-27 10:16:51.000000000 +0000
+++ ./source/private_module/enterprise/event/rephc_event.c.hotpatch	2019-03-20 08:28:44.000000000 +0000
@@ -2502,7 +2502,7 @@
         releaseAllRepHcTntNode(startSvcPara->tntNode);
         startSvcPara->tntNode = NULL;
     }
-
+    HcUnsetOstypeMasterTracePoint();
     startSvcPara->callback(startSvcPara->context, (uint32_t)result);
 
     /*H2:ȥע̳ʱ*/
@@ -5784,7 +5784,7 @@
     void* pairLock = NULL;
     bool isStartSvc = FALSE;
     REP_LOCK_PARM_S repLockParam;
-
+    uint32_t svcStatus = INVALID_VALUE32;
     if(NULL == data)
     {
         DBG_LogError(REPHC_LOG_ID_NEW, "IodHandleLinkDown retry context is NULL.");
@@ -5821,10 +5821,10 @@
     getRepHcPairIsInService(event->localPairId, &isStartSvc);
     if (!isStartSvc)
     {
-        DBG_LogWarning(REPHC_LOG_ID_NEW, "Pair still not started service, wait and retry,"
-            "PairId %llx, localId %u, retryTime %lld.",
-            event->pairUUID, event->localPairId, delayTime);
-        /*(pairѽ)*/
+        getRepHcPairSvcStatus(event->localPairId, &svcStatus); if(REPHC_PAIR_SVC_STOP_BGR == svcStatus){
+            DBG_LogError(REPHC_LOG_ID_NEW,  "Pair has stop bgr, pairId(%llx), eventType(%u).",event->pairUUID, event->eventCode);            
+            handleBatchPairLockCallbackErr(event); return; }            
+        DBG_LogWarning(REPHC_LOG_ID_NEW, "Pair still not started service, wait and retry,""PairId %llx, localId %u, retryTime %lld.",event->pairUUID, event->localPairId, delayTime);
         batchLinkDownWaitServiceRetry(event);
         return;
     }
@@ -16805,7 +16805,7 @@
     handleRephcEvtLockPairErr(event, RETURN_REPHC_PAIR_NOT_START_SERVICE);
     return;
 }
-
+extern void eventRepHcChkErrhandle(REPHC_EVENT_S* event, int32_t result);
 /*******************************************************************************
 *     : 鴦PAIR¼
 * : usrEvent
@@ -16821,7 +16821,7 @@
     int32_t result = RETURN_ERROR;
     REPHC_EVENT_S* event = NULL;
     void* lockInfo = NULL;
-
+    uint32_t svcStatus = INVALID_VALUE32;
     event = (REPHC_EVENT_S* )context;
     lockInfo = getRepHcPairLockInfo(event->localPairId);
     /* ѾDSϲ÷֧ */
@@ -16848,11 +16848,11 @@
     LVOS_TP_END
     if (!isStartSvc)
     {
-        DBG_LogError(REPHC_LOG_ID_NEW,
-            "Pair has not started service,pair id(%llx), eventType(%u).",
-            event->pairUUID, event->eventCode);
-        if (event->isNeedLock)
-        {
+        getRepHcPairSvcStatus(event->localPairId, &svcStatus); if(REPHC_PAIR_SVC_STOP_BGR == svcStatus){
+            DBG_LogError(REPHC_LOG_ID_NEW,  "Pair has stop bgr, pair id(%llx), eventType(%u).",event->pairUUID, event->eventCode);
+            eventRepHcChkErrhandle(event, result); return; }
+        DBG_LogError(REPHC_LOG_ID_NEW,"Pair has not started service,pair id(%llx), eventType(%u).",event->pairUUID, event->eventCode);
+        if (event->isNeedLock){
             UNLOCK_REP_PAIR(lockInfo);
         }
         handleRephcEventWaitSvcRetry(event);
@@ -20640,3 +20640,45 @@
     return RETURN_OK;
 }
 
+
+
+/**********************************************************************
+*     : ¼ִɴ
+* : ¼Ϣṹָ
+* : 
+*   ֵ: 
+* ע: 
+**********************************************************************/
+void eventRepHcChkErrhandle(REPHC_EVENT_S* event, int32_t result)
+{
+    void *pairLock = NULL;
+
+    if(NULL == event)
+    {
+        REPHC_SYS_BUG(SYS_BUG_NORM, MODULE_FUNC_HANG, "Event handle over rephc failed, event is NULL.");
+        return;
+    }
+    pairLock = getRepHcPairLockInfo(event->localPairId);
+    if (NULL == pairLock)
+    {
+        DBG_LogDebug(REPHC_LOG_ID_NEW, "Pair not existed. id(%d).",
+                       event->localPairId);
+    }
+    else if(event->isNeedLock)
+    {
+        UNLOCK_REP_PAIR(pairLock);
+    }
+
+    if (event->isNeedLock)
+    {
+        /*ͷds*/
+        checkAndUnlockDsByDsType(event->localDsID, event->dsType);
+
+        /*ͷ⻧pair*/
+        release3DCDlmLockByLocalDsId(event->localDsID, event->dsType, TRUE);
+    }
+
+    eventPrehandleOverRepHc(event, result);
+    return;
+}
+
