--- ./source/private_module/ramcache/iocore/iobase/io_base.c	2018-04-27 09:42:16.000000000 +0000
+++ ./source/private_module/ramcache/iocore/iobase/io_base.c.hotpatch	2018-12-25 07:35:01.000000000 +0000
@@ -7288,14 +7288,12 @@
     SYS_BUG_EXP(NULL != cacheBase, SYS_BUG_CRI, MODULE_FUNC_END, "Bug: (%s) not satisfy.", "NULL != cacheBase");
 
     pri = getReqPriority(req);
-
     retryType = switchAllocTypeToRetryType(cacheBase, allocType);
     retryType = (isFileSystemCacheBase(cacheBase) && IS_SHARED_RETRY_TYPE(retryType)) ? (retryTypeToFsRetryType(retryType)) : (retryType);
     retryType = (!g_isPurleyHigh || cacheBase->localCtrl)? (retryType) : retryTypeToMirrorRetryType(retryType);
     retryListIdx = IS_NO_PTT_RETRY_TYPE(retryType) ? DEFAULT_INNER_CACHE_PTT_INDEX : GET_CACHE_PTT_INDEX(cacheBase->partition);
     /* CACHE_DBG_ASSERT_EXPR(retryListIdx < MAX_RETRY_LIST_CNT, "Bad ptt id: %u", cacheBase->partition);*/
     SYS_BUG_EXP(retryListIdx < MAX_RETRY_LIST_CNT, SYS_BUG_CRI, MODULE_FUNC_END, "Bad ptt id: %u", cacheBase->partition);
-
     if (unlikely(retryType >= CACHE_RETRY_BUTT))
     {
         /* DBG_ASSERT(0);*/
@@ -7303,10 +7301,8 @@
 
         return;
     }
-
     baseType  = switchBaseToRetryBaseType(ioCommon->cacheBasePtr);
     priQueue  = getGlobalPriQueue(retryListIdx, baseType, retryType);
-
     if (unlikely((CACHE_RETRY_BUTT == retryType)
                  || (!g_cacheWaitAllocNeedHang)
                  || (!cacheBase->isHangWaitAlloc)
@@ -7326,12 +7322,8 @@
         retryFunc(req);
         return;
     }
-
-    ioCommon->isNewReqHung = TRUE;
     ioCommon->waitAllocNum = allocNum;
     ioCommon->possWaitType = (uint32_t)retryType;
-
-    /* Ŀǰֻ֧дREQIOD */
     if (REQ_CAN_CHANGE_CONTEXT(req->opCode, retryType))
     {
         context = GET_CACHE_REQ_CONTEXT_PRIVATE(req);
@@ -7343,10 +7335,18 @@
     {
         ioCommon->retryWaitAllocFunc = retryFunc;
     }
-
     ioCommon->stepStartTime = jiffies;
-    insertReqToPriRetryList(priQueue,pri,req);
-
+    if ((OP_CACHE_ASYNC_WRITEMIRROR == req->opCode) && (B_FALSE == ioCommon->isNewReqHung) && IS_SHARED_RETRY_TYPE(retryType))
+    {
+        ioCommon->isNewReqHung = TRUE;
+        spinLockListAddTail(&ioCommon->nodeInWaitAllocList, &priQueue->retryList[pri]);
+        atomic_inc(&priQueue->sum);
+    }
+    else
+    {
+        ioCommon->isNewReqHung = TRUE;
+        insertReqToPriRetryList(priQueue,pri,req);
+    }
     return;
 }
 bool isRetryReadNeedWaitType(IN uint8_t index)
@@ -7472,8 +7472,6 @@
             priQueue = &g_waitAllocList[retryListIdx][retryBaseType].priQueue[index];
         }
 
-
-
         if (REQ_CAN_CHANGE_CONTEXT(req->opCode, index))
         {
             context = GET_CACHE_REQ_CONTEXT_PRIVATE(req);
@@ -7487,14 +7485,16 @@
         }
         ioCommon->stepStartTime = jiffies;
 		ioCommon->possWaitType = (uint32_t)index;
-
         copyCtxTrace2Req(req);
 
-        insertReqToPriRetryList(priQueue, pri, req);
+        spinLockListAddTail(&ioCommon->nodeInWaitAllocList, &priQueue->retryList[pri]);
+        atomic_inc(&priQueue->sum);
+
         return RETURN_OK;
 
 
     }
+
     UNREFERENCE_PARAM(req);
     return RETURN_ERROR;
 }
@@ -7552,17 +7552,17 @@
     {
         ioCommon->retryWaitAllocFunc = retryFunc;
     }
-    //ioCommon->ioStartTime = (int64_t)jiffies;
+
     ioCommon->possWaitType = (uint32_t)retryAllocType;
 
     copyCtxTrace2Req(req);
 
-    insertReqToPriRetryList(priQueue, pri, req);
+    ioCommon->isNewReqHung = B_TRUE;
+    spinLockListAddTail(&ioCommon->nodeInWaitAllocList, &priQueue->retryList[pri]);
+    atomic_inc(&priQueue->sum);
 
     UNREFERENCE_PARAM(waitType);
-
     return ;
-
 }
 
 /**************************************************************************
@@ -7630,18 +7630,18 @@
     {
         ioCommon->retryWaitAllocFunc = retryFunc;
     }
-    //ioCommon->ioStartTime = (int64_t)jiffies;
     ioCommon->possWaitType = (uint32_t)index;
 
     copyCtxTrace2Req(req);
 
-    insertReqToPriRetryList(priQueue, pri, req);
+    ioCommon->isNewReqHung = B_TRUE;
+    spinLockListAddTail(&ioCommon->nodeInWaitAllocList, &priQueue->retryList[pri]);
+    atomic_inc(&priQueue->sum);
 
     UNREFERENCE_PARAM(waitType);
 
     return RETURN_OK;
 
-
 }
 
 /**************************************************************************
@@ -7913,32 +7913,26 @@
     ALLOC_QUOTA_TYPE_E *allocQuotaType;
     CACHE_REQ_PRIVATE_COMMON_S *ioCommon = NULL;
     SPIN_LOCK_LIST_HEAD_S *retryList = NULL;
-
+    CACHE_REQ_PRIVATE_CONTEXT_S *context = NULL;
     if (!g_cacheWaitAllocNeedHang)
     {
         return FALSE;
     }
-
     ioCommon = GET_CACHE_REQ_COMMON_PRIVATE(req);
     if (TRUE == ioCommon->isNewReqHung)
     {
         return FALSE;
     }
-
     ioCommon->stepStartTime = jiffies;
-
     copyCtxTrace2Req(req);
-
     baseObj = ioCommon->cacheBasePtr;
     /* DBG_ASSERT(NULL != baseObj);*/
     SYS_BUG_EXP(NULL != baseObj, SYS_BUG_CRI, MODULE_FUNC_END, "Bug: (%s) not satisfy.", "NULL != baseObj");
-
     pri = getReqPriority(req);
     /* list nodeҪcache */
     retryBaseType = switchBaseToRetryBaseType(baseObj);
     retryListIdx  = GET_CACHE_PTT_INDEX(baseObj->partition);
     priQueue = &g_waitAllocList[retryListIdx][retryBaseType].priQueue[CACHE_RETRY_LIST_NODE];
-
     if (0 < retryListCount(priQueue))
     {
     	ioCommon->possWaitType = CACHE_RETRY_LIST_NODE;
@@ -7947,24 +7941,30 @@
         insertReqToPriRetryList(priQueue, pri, req);
         return TRUE;
     }
-
     retryList = &baseObj->possWaitAllocList;
     if (0 < spinLockListCount(retryList))
     {
         ioCommon->possWaitType = CACHE_RETRY_WRITE_CHUNK;
-        ioCommon->retryWaitAllocFunc = retryFunc;
-        ioCommon->isNewReqHung = TRUE;
-        insertWaitAllocReqToOrderList(retryList, req);
-        return TRUE;
+        context = GET_CACHE_REQ_CONTEXT_PRIVATE(req);
+        context->retryWaitCallBack = retryFunc;
+        context->changeContextType = CHANGE_CONTEXT_RETRY_WAIT;
+        ioCommon->retryWaitAllocFunc = changeContextRetryWaitCallBack;
+        if (B_FALSE == ioCommon->isNewReqHung)
+        {
+            ioCommon->isNewReqHung = TRUE;
+            spinLockListAddTail(&ioCommon->nodeInWaitAllocList, retryList);
+            return TRUE;
+        }
+
+        ioCommon->isNewReqHung = B_TRUE;
+        return FALSE;
     }
 
-    /* ԴҪquota */
     getAllocQuotaTypeSet(baseObj, waitType, &allocQuotaType, &size);
     if (NULL == allocQuotaType)
     {
         return FALSE;
     }
-
     for (index = 0; index < size; index++)
     {
         if (isNeedWaitOnPoolRetryList(req, baseObj))
@@ -8042,26 +8042,26 @@
         return RETURN_ERROR;
     }
     node = curList->head.next;
-    /*ȡеһڵ㣬鿴ýڵ*/
+
     randomIoCommon = list_entry(node, CACHE_REQ_PRIVATE_COMMON_S, nodeInWaitAllocList);
     ioCommon->possWaitType = randomIoCommon->possWaitType;
     ioCommon->retryWaitAllocFunc = retryFunc;
 
-
-    /* Ŀǰ֧дIOD */
     context = GET_CACHE_REQ_CONTEXT_PRIVATE(req);
     context->retryWaitCallBack = ioCommon->retryWaitAllocFunc;
     context->changeContextType = CHANGE_CONTEXT_RETRY_WAIT;
     ioCommon->retryWaitAllocFunc = changeContextRetryWaitCallBack;
     ioCommon->stepStartTime = jiffies;
     copyCtxTrace2Req(req);
-    insertWaitAllocReqToOrderListNoLock(curList, req);
+
+    spinLockListAddTailNoLock(&ioCommon->nodeInWaitAllocList, curList);
+
+
     spin_unlock(&curList->spinlock);
     INC_DBG_LABEL_STAT(HANG_POSS_CHECK_NEW_IO);
 
 
     return RETURN_OK;
-
 }
 /**************************************************************************
      :  Դʱ
--- ./source/private_module/ramcache/metadata/cachechunk/chunk_fsm.c	2018-03-19 08:01:18.000000000 +0000
+++ ./source/private_module/ramcache/metadata/cachechunk/chunk_fsm.c.hotpatch	2018-12-25 07:35:01.000000000 +0000
@@ -624,7 +624,7 @@
         }
     }
 
-    if (unlikely(B_TRUE == ioPrivate->writeThrough))
+    if (unlikely(B_TRUE == ioPrivate->writeVolatile))
     {
         destageType = DESTAGE_TYPE_WRITETHROUGH;
     }
