VirtualBox

Changeset 23602 in vbox for trunk/src


Ignore:
Timestamp:
Oct 7, 2009 6:29:34 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53274
Message:

Runtime/Aio: Bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp

    r23411 r23602  
    277277
    278278            ASMAtomicDecS32(&pCtxInt->cRequests);
     279            AssertMsg(pCtxInt->cRequests >= 0, ("Canceled request not which is not in this context\n"));
    279280            RTSemEventSignal(pCtxInt->SemEventCancel);
    280281        }
     
    650651            if (RT_UNLIKELY(rcPosix < 0))
    651652            {
     653                size_t cReqsSubmitted = cReqsSubmit;
     654
    652655                if (errno == EAGAIN)
    653656                    rc = VERR_FILE_AIO_INSUFFICIENT_RESSOURCES;
     
    656659
    657660                /* Check which ones were not submitted. */
    658                 for (i = 0; i < cReqs; i++)
     661                for (i = 0; i < cReqsSubmit; i++)
    659662                {
    660663                    pReqInt = pahReqs[i];
     
    664667                    if ((rcPosix != EINPROGRESS) && (rcPosix != 0))
    665668                    {
    666                         cReqsSubmit--;
     669                        cReqsSubmitted--;
    667670
    668671#if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
     
    703706                        else
    704707                            pHead = pNext;
     708
     709                        pReqInt->pNext = NULL;
     710                        pReqInt->pPrev = NULL;
    705711                    }
    706712                }
    707 
     713                ASMAtomicAddS32(&pCtxInt->cRequests, cReqsSubmitted);
     714                AssertMsg(pCtxInt->cRequests > 0, ("Adding requests resulted in overflow\n"));
    708715                break;
    709716            }
    710717
    711718            ASMAtomicAddS32(&pCtxInt->cRequests, cReqsSubmit);
     719            AssertMsg(pCtxInt->cRequests > 0, ("Adding requests resulted in overflow\n"));
    712720            cReqs   -= cReqsSubmit;
    713721            pahReqs += cReqsSubmit;
     
    720728         * above.
    721729         */
    722         if (cReqs)
     730        if (cReqs && RT_SUCCESS_NP(rc))
    723731        {
    724732            pReqInt = pahReqs[0];
    725733            RTFILEAIOREQ_VALID_RETURN(pReqInt);
    726 
    727734
    728735            if (pReqInt->fFlush)
     
    754761
    755762                ASMAtomicIncS32(&pCtxInt->cRequests);
     763                AssertMsg(pCtxInt->cRequests > 0, ("Adding requests resulted in overflow\n"));
    756764                cReqs--;
    757765                pahReqs++;
    758766            }
    759767        }
    760     } while (cReqs);
     768    } while (   cReqs
     769             && RT_SUCCESS_NP(rc));
    761770
    762771    if (pHead)
     
    815824    AssertReturn(cReqs >= cMinReqs, VERR_OUT_OF_RANGE);
    816825
    817     if (RT_UNLIKELY(ASMAtomicReadS32(&pCtxInt->cRequests) == 0))
     826    int32_t cRequestsWaiting = ASMAtomicReadS32(&pCtxInt->cRequests);
     827
     828    if (RT_UNLIKELY(cRequestsWaiting == 0))
    818829        return VERR_FILE_AIO_NO_REQUEST;
     830
     831    if (RT_UNLIKELY(cMinReqs > cRequestsWaiting))
     832        return VERR_INVALID_PARAMETER;
    819833
    820834    if (cMillisTimeout != RT_INDEFINITE_WAIT)
     
    945959            ASMAtomicSubS32(&pCtxInt->cRequests, cDone);
    946960
     961            AssertMsg(pCtxInt->cRequests >= 0, ("Finished more requests than currently active\n"));
     962
    947963            if (!cMinReqs)
    948964                break;
Note: See TracChangeset for help on using the changeset viewer.

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