VirtualBox

Changeset 43669 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 17, 2012 1:20:03 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81452
Message:

Main/MediumImpl: Fix deadlock when two threads attempt to close the same medium object. Triggers lock order violation which is not detectable by the lock validator as only one lock is a RW semaphore, the other one is the AutoCaller event semaphore used for synchronizing callers and init/uninit.

File:
1 edited

Legend:

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

    r43478 r43669  
    41584158        multilock.release();
    41594159        markRegistriesModified();
     4160        // Release the AutoCalleri now, as otherwise uninit() will simply hang.
     4161        // Needs to be done before saving the registry, as otherwise there
     4162        // may be a deadlock with someone else closing this object while we're
     4163        // in saveModifiedRegistries(), which needs the media tree lock, which
     4164        // the other thread holds until after uninit() below.
     4165        /// @todo redesign the locking here, as holding the locks over uninit causes lock order trouble which the lock validator can't detect
     4166        autoCaller.release();
    41604167        m->pVirtualBox->saveModifiedRegistries();
    41614168        multilock.acquire();
    41624169    }
    4163 
    4164     // release the AutoCaller, as otherwise uninit() will simply hang
    4165     autoCaller.release();
     4170    else
     4171    {
     4172        // release the AutoCaller, as otherwise uninit() will simply hang
     4173        autoCaller.release();
     4174    }
    41664175
    41674176    // Keep the locks held until after uninit, as otherwise the consistency
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