VirtualBox

Changeset 97494 in vbox


Ignore:
Timestamp:
Nov 10, 2022 1:14:55 PM (2 years ago)
Author:
vboxsync
Message:

Storage/VD: Fall back to synchronous I/O even for async requests if the async I/O interface is not available. Fixes virtio-scsi failing with the host cache enabled because it will submit concurrent requests from different threads which means some of the synchronous requests get converted to asynchronous requests due to disk lock contention, ticketref:19717

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/user_ChangeLogImpl.xml

    r97492 r97494  
    104104
    105105      <listitem>
     106        <para>Storage: Fixed I/O errors with the VirtioSCSI controller when the host I/O cache is enabled (bug #19717)</para>
     107      </listitem>
     108
     109      <listitem>
    106110        <para>3D: Fixed VM process crash on macOS with 3D enabled (bug #21232)</para>
    107111      </listitem>
  • trunk/src/VBox/Storage/VD.cpp

    r96407 r97494  
    33223322
    33233323/**
    3324  * VD async I/O interface callback for a asynchronous read from the file.
    3325  */
    3326 static DECLCALLBACK(int) vdIOReadAsyncFallback(void *pvUser, void *pStorage, uint64_t uOffset,
    3327                                                PCRTSGSEG paSegments, size_t cSegments,
    3328                                                size_t cbRead, void *pvCompletion,
    3329                                                void **ppTask)
    3330 {
    3331     RT_NOREF8(pvUser, pStorage, uOffset, paSegments, cSegments, cbRead, pvCompletion, ppTask);
    3332     AssertFailed();
    3333     return VERR_NOT_IMPLEMENTED;
    3334 }
    3335 
    3336 /**
    3337  * VD async I/O interface callback for a asynchronous write to the file.
    3338  */
    3339 static DECLCALLBACK(int) vdIOWriteAsyncFallback(void *pvUser, void *pStorage, uint64_t uOffset,
    3340                                                 PCRTSGSEG paSegments, size_t cSegments,
    3341                                                 size_t cbWrite, void *pvCompletion,
    3342                                                 void **ppTask)
    3343 {
    3344     RT_NOREF8(pvUser, pStorage, uOffset, paSegments, cSegments, cbWrite, pvCompletion, ppTask);
    3345     AssertFailed();
    3346     return VERR_NOT_IMPLEMENTED;
    3347 }
    3348 
    3349 /**
    3350  * VD async I/O interface callback for a asynchronous flush of the file data.
    3351  */
    3352 static DECLCALLBACK(int) vdIOFlushAsyncFallback(void *pvUser, void *pStorage,
    3353                                                 void *pvCompletion, void **ppTask)
    3354 {
    3355     RT_NOREF4(pvUser, pStorage, pvCompletion, ppTask);
    3356     AssertFailed();
    3357     return VERR_NOT_IMPLEMENTED;
    3358 }
    3359 
    3360 /**
    33613324 * Internal - Continues an I/O context after
    33623325 * it was halted because of an active transfer.
     
    39963959    Assert(cbRead > 0);
    39973960
    3998     if (pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     3961    if (   (pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     3962        || !pVDIo->pInterfaceIo->pfnReadAsync)
    39993963    {
    40003964        RTSGSEG Seg;
     
    40944058    Assert(cbWrite > 0);
    40954059
    4096     if (pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     4060    if (   (pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     4061        || !pVDIo->pInterfaceIo->pfnWriteAsync)
    40974062    {
    40984063        RTSGSEG Seg;
     
    42044169
    42054170    if (   !pIoCtx
    4206         || pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     4171        || pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC
     4172        || !pVDIo->pInterfaceIo->pfnReadAsync)
    42074173    {
    42084174        /* Handle synchronous metadata I/O. */
     
    43264292
    43274293    if (   !pIoCtx
    4328         || pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     4294        || pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC
     4295        || !pVDIo->pInterfaceIo->pfnWriteAsync)
    43294296    {
    43304297        /* Handle synchronous metadata I/O. */
     
    45194486
    45204487    if (   !pIoCtx
    4521         || pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC)
     4488        || pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC
     4489        || !pVDIo->pInterfaceIo->pfnFlushAsync)
    45224490    {
    45234491        /* Handle synchronous flushes. */
     
    49834951    pIfIo->pfnWriteSync           = vdIOWriteSyncFallback;
    49844952    pIfIo->pfnFlushSync           = vdIOFlushSyncFallback;
    4985     pIfIo->pfnReadAsync           = vdIOReadAsyncFallback;
    4986     pIfIo->pfnWriteAsync          = vdIOWriteAsyncFallback;
    4987     pIfIo->pfnFlushAsync          = vdIOFlushAsyncFallback;
     4953    pIfIo->pfnReadAsync           = NULL;
     4954    pIfIo->pfnWriteAsync          = NULL;
     4955    pIfIo->pfnFlushAsync          = NULL;
    49884956}
    49894957
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