VirtualBox

Changeset 29587 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 17, 2010 9:42:26 PM (15 years ago)
Author:
vboxsync
Message:

AsyncCompletion: Fix hang when closing the VM and flush the cache

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp

    r29450 r29587  
    912912static int pdmacFileEpClose(PPDMASYNCCOMPLETIONENDPOINT pEndpoint)
    913913{
     914    int rc = VINF_SUCCESS;
    914915    PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEndpoint;
    915916    PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE)pEndpoint->pEpClass;
    916917
     918    /* Free the cached data. */
     919    if (pEpFile->fCaching)
     920    {
     921        rc = pdmacFileEpCacheFlush(pEpFile);
     922        AssertRC(rc);
     923        pdmacFileEpCacheDestroy(pEpFile);
     924    }
     925
    917926    /* Make sure that all tasks finished for this endpoint. */
    918     int rc = pdmacFileAioMgrCloseEndpoint(pEpFile->pAioMgr, pEpFile);
     927    rc = pdmacFileAioMgrCloseEndpoint(pEpFile->pAioMgr, pEpFile);
    919928    AssertRC(rc);
    920929
     
    940949    }
    941950
    942     /* Free the cached data. */
    943     if (pEpFile->fCaching)
    944         pdmacFileEpCacheDestroy(pEpFile);
    945 
    946951    /* Remove from the bandwidth manager */
    947952    pdmacFileBwUnref(pEpFile->pBwMgr);
     
    10321037    if (pEpFile->fCaching)
    10331038    {
    1034         int rc = pdmacFileEpCacheFlush(pEpFile, pTaskFile);
     1039        int rc = pdmacFileEpCacheFlush(pEpFile);
    10351040        AssertRC(rc);
    10361041    }
  • trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp

    r29250 r29587  
    11441144    while (ASMAtomicReadU32(&pEntry->fFlags) & (PDMACFILECACHE_ENTRY_IO_IN_PROGRESS | PDMACFILECACHE_ENTRY_IS_DIRTY))
    11451145    {
     1146        /* Leave the locks to let the I/O thread make progress but reference the entry to prevent eviction. */
     1147        pdmacFileEpCacheEntryRef(pEntry);
    11461148        RTSemRWReleaseWrite(pEndpointCache->SemRWEntries);
     1149        pdmacFileCacheLockLeave(pCache);
     1150
    11471151        RTThreadSleep(250);
     1152
     1153        /* Re-enter all locks */
     1154        pdmacFileCacheLockEnter(pCache);
    11481155        RTSemRWRequestWrite(pEndpointCache->SemRWEntries, RT_INDEFINITE_WAIT);
     1156        pdmacFileEpCacheEntryRelease(pEntry);
    11491157    }
    11501158
     
    21752183}
    21762184
    2177 int pdmacFileEpCacheFlush(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask)
     2185int pdmacFileEpCacheFlush(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint)
    21782186{
    21792187    int rc = VINF_SUCCESS;
    21802188
    2181     LogFlowFunc((": pEndpoint=%#p{%s} pTask=%#p\n",
    2182                  pEndpoint, pEndpoint->Core.pszUri, pTask));
     2189    LogFlowFunc((": pEndpoint=%#p{%s}\n", pEndpoint, pEndpoint->Core.pszUri));
    21832190
    21842191    /* Commit dirty entries in the cache. */
  • trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h

    r29466 r29587  
    727727                          RTFOFF off, PCRTSGSEG paSegments, size_t cSegments,
    728728                          size_t cbWrite);
    729 int pdmacFileEpCacheFlush(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMASYNCCOMPLETIONTASKFILE pTask);
     729int pdmacFileEpCacheFlush(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint);
    730730
    731731RT_C_DECLS_END
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette