VirtualBox

Changeset 38764 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 15, 2011 2:09:40 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74046
Message:

Main/Medium+Machine: final lock order fixes

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r38535 r38764  
    660660                        NULL);       /* pllRegistriesThatNeedSaving */
    661661        if (FAILED(rc)) throw rc;
     662
     663        // need tree lock for createMediumLockList
     664        AutoWriteLock treeLock(p->getVirtualBox()->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     665
    662666        MediumLockList *pMediumLockList(new MediumLockList());
    663667        rc = diff->createMediumLockList(true /* fFailIfInaccessible */,
     
    668672        rc = pMediumLockList->Lock();
    669673        if (FAILED(rc)) throw rc;
     674
     675        treeLock.release();
     676
    670677        /* this already registers the new diff image */
    671678        rc = pParent->createDiffStorage(diff, MediumVariant_Standard,
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r38744 r38764  
    10491049    if (fForceNewUuid)
    10501050        unconst(m->uuidImage).create();
    1051     rc = queryInfo(fForceNewUuid /* fSetImageId */, false /* fSetParentId */);
     1051
     1052    {
     1053        // Medium::queryInfo needs write lock
     1054        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     1055        rc = queryInfo(fForceNewUuid /* fSetImageId */, false /* fSetParentId */);
     1056    }
    10521057
    10531058    if (SUCCEEDED(rc))
     
    19551960    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    19561961
    1957     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1962    AutoMultiWriteLock2 alock(&m->pVirtualBox->getMediaTreeLockHandle(),
     1963                              this->lockHandle() COMMA_LOCKVAL_SRC_POS);
    19581964
    19591965    switch (m->state)
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