Index: /trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp
===================================================================
--- /trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp	(revision 23974)
+++ /trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp	(revision 23975)
@@ -490,10 +490,15 @@
     pEntry->fFlags &= ~PDMACFILECACHE_ENTRY_IO_IN_PROGRESS;
 
+    /* Process waiting segment list. The data in entry might have changed inbetween. */
+    PPDMACFILETASKSEG pCurr = pEntry->pWaitingHead;
+
+    AssertMsg((pCurr && pEntry->pWaitingTail) || (!pCurr && !pEntry->pWaitingTail),
+                ("The list tail was not updated correctly\n"));
+    pEntry->pWaitingTail = NULL;
+    pEntry->pWaitingHead = NULL;
+
     if (pTask->enmTransferType == PDMACTASKFILETRANSFER_WRITE)
     {
         pEntry->fFlags &= ~PDMACFILECACHE_ENTRY_IS_DIRTY;
-
-        /* Process waiting segment list. The data in entry might have changed inbetween. */
-        PPDMACFILETASKSEG pCurr = pEntry->pHead;
 
         while (pCurr)
@@ -520,7 +525,4 @@
         AssertMsg(pTask->enmTransferType == PDMACTASKFILETRANSFER_READ, ("Invalid transfer type\n"));
         AssertMsg(!(pEntry->fFlags & PDMACFILECACHE_ENTRY_IS_DIRTY),("Invalid flags set\n"));
-
-        /* Process waiting segment list. */
-        PPDMACFILETASKSEG pCurr = pEntry->pHead;
 
         while (pCurr)
@@ -546,6 +548,4 @@
         }
     }
-
-    pEntry->pHead = NULL;
 
     if (pEntry->fFlags & PDMACFILECACHE_ENTRY_IS_DIRTY)
@@ -844,5 +844,6 @@
     pEntryNew->pList        = NULL;
     pEntryNew->cbData       = cbData;
-    pEntryNew->pHead        = NULL;
+    pEntryNew->pWaitingHead = NULL;
+    pEntryNew->pWaitingTail = NULL;
     pEntryNew->pbData       = (uint8_t *)RTMemPageAlloc(cbData);
 
@@ -854,4 +855,32 @@
 
     return pEntryNew;
+}
+
+/**
+ * Adds a segment to the waiting list for a cache entry
+ * which is currently in progress.
+ *
+ * @returns nothing.
+ * @param   pEntry    The cache entry to add the segment to.
+ * @param   pSeg      The segment to add.
+ */
+static void pdmacFileEpCacheEntryAddWaitingSegment(PPDMACFILECACHEENTRY pEntry, PPDMACFILETASKSEG pSeg)
+{
+    pSeg->pNext = NULL;
+
+    if (pEntry->pWaitingHead)
+    {
+        AssertPtr(pEntry->pWaitingTail);
+
+        pEntry->pWaitingTail->pNext = pSeg;
+        pEntry->pWaitingTail = pSeg;
+    }
+    else
+    {
+        Assert(!pEntry->pWaitingTail);
+
+        pEntry->pWaitingHead = pSeg;
+        pEntry->pWaitingTail = pSeg;
+    }
 }
 
@@ -971,6 +1000,5 @@
                             ADVANCE_SEGMENT_BUFFER(pSeg->cbTransfer);
 
-                            pSeg->pNext = pEntry->pHead;
-                            pEntry->pHead = pSeg;
+                            pdmacFileEpCacheEntryAddWaitingSegment(pEntry, pSeg);
 
                             off      += pSeg->cbTransfer;
@@ -1051,6 +1079,5 @@
                     ADVANCE_SEGMENT_BUFFER(pSeg->cbTransfer);
 
-                    pSeg->pNext = pEntry->pHead;
-                    pEntry->pHead = pSeg;
+                    pdmacFileEpCacheEntryAddWaitingSegment(pEntry, pSeg);
 
                     off      += pSeg->cbTransfer;
@@ -1136,6 +1163,5 @@
                     ADVANCE_SEGMENT_BUFFER(pSeg->cbTransfer);
 
-                    pSeg->pNext = pEntryNew->pHead;
-                    pEntryNew->pHead = pSeg;
+                    pdmacFileEpCacheEntryAddWaitingSegment(pEntryNew, pSeg);
 
                     off        += pSeg->cbTransfer;
@@ -1274,6 +1300,5 @@
                             ADVANCE_SEGMENT_BUFFER(pSeg->cbTransfer);
 
-                            pSeg->pNext = pEntry->pHead;
-                            pEntry->pHead = pSeg;
+                            pdmacFileEpCacheEntryAddWaitingSegment(pEntry, pSeg);
 
                             off       += pSeg->cbTransfer;
@@ -1335,6 +1360,5 @@
                                 ADVANCE_SEGMENT_BUFFER(pSeg->cbTransfer);
 
-                                pSeg->pNext = pEntry->pHead;
-                                pEntry->pHead = pSeg;
+                                pdmacFileEpCacheEntryAddWaitingSegment(pEntry, pSeg);
 
                                 off       += pSeg->cbTransfer;
@@ -1424,6 +1448,5 @@
                     ADVANCE_SEGMENT_BUFFER(pSeg->cbTransfer);
 
-                    pSeg->pNext = pEntry->pHead;
-                    pEntry->pHead = pSeg;
+                    pdmacFileEpCacheEntryAddWaitingSegment(pEntry, pSeg);
 
                     off       += pSeg->cbTransfer;
Index: /trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h
===================================================================
--- /trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h	(revision 23974)
+++ /trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h	(revision 23975)
@@ -229,6 +229,8 @@
     /** Pointer to the memory containing the data. */
     uint8_t                        *pbData;
-    /** List of tasks waiting for this one to finish. */
-    PPDMACFILETASKSEG               pHead;
+    /** Head of list of tasks waiting for this one to finish. */
+    PPDMACFILETASKSEG               pWaitingHead;
+    /** Tail of list of tasks waiting for this one to finish. */
+    PPDMACFILETASKSEG               pWaitingTail;
 } PDMACFILECACHEENTRY, *PPDMACFILECACHEENTRY;
 /** I/O is still in progress for this entry. This entry is not evictable. */
