Changeset 92464 in vbox for trunk/src/VBox/Main/src-server/MediumImpl.cpp
- Timestamp:
- Nov 16, 2021 5:59:16 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 148322
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r91718 r92464 1839 1839 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 1840 1840 1841 /* Wait for a concurrently running Medium::i_queryInfo to complete. */ 1842 while (m->queryInfoRunning) 1843 { 1844 mlock.release(); 1845 autoCaller.release(); 1846 treeLock.release(); 1847 /* Must not hold the media tree lock, as Medium::i_queryInfo needs 1848 * this lock and thus we would run into a deadlock here. */ 1849 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 1850 /* must not hold the object lock now */ 1851 Assert(!isWriteLockOnCurrentThread()); 1852 { 1853 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 1854 } 1855 treeLock.acquire(); 1856 autoCaller.add(); 1857 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1858 mlock.acquire(); 1859 } 1860 1841 1861 switch (m->state) 1842 1862 { … … 2111 2131 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2112 2132 2133 /* Wait for a concurrently running Medium::i_queryInfo to complete. */ 2134 if (m->queryInfoRunning) 2135 { 2136 /* Must not hold the media tree lock, as Medium::i_queryInfo needs this 2137 * lock and thus we would run into a deadlock here. */ 2138 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2139 while (m->queryInfoRunning) 2140 { 2141 alock.release(); 2142 /* must not hold the object lock now */ 2143 Assert(!isWriteLockOnCurrentThread()); 2144 { 2145 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 2146 } 2147 alock.acquire(); 2148 } 2149 } 2150 2113 2151 switch (m->state) 2114 2152 { … … 2498 2536 { 2499 2537 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 2538 2539 /* Wait for a concurrently running Medium::i_queryInfo to complete. */ 2540 if (m->queryInfoRunning) 2541 { 2542 /* Must not hold the media tree lock, as Medium::i_queryInfo needs this 2543 * lock and thus we would run into a deadlock here. */ 2544 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2545 while (m->queryInfoRunning) 2546 { 2547 mlock.release(); 2548 /* must not hold the object lock now */ 2549 Assert(!isWriteLockOnCurrentThread()); 2550 { 2551 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 2552 } 2553 mlock.acquire(); 2554 } 2555 } 2500 2556 2501 2557 switch (m->state) … … 5230 5286 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5231 5287 5288 /* Wait for a concurrently running Medium::i_queryInfo to complete. */ 5289 while (m->queryInfoRunning) 5290 { 5291 autoCaller.release(); 5292 multilock.release(); 5293 /* Must not hold the media tree lock, as Medium::i_queryInfo needs 5294 * this lock and thus we would run into a deadlock here. */ 5295 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5296 /* must not hold the object lock now */ 5297 Assert(!isWriteLockOnCurrentThread()); 5298 { 5299 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 5300 } 5301 multilock.acquire(); 5302 autoCaller.add(); 5303 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5304 } 5305 5232 5306 LogFlowFunc(("ENTER for %s\n", i_getLocationFull().c_str())); 5233 5307 … … 5318 5392 */ 5319 5393 HRESULT Medium::i_deleteStorage(ComObjPtr<Progress> *aProgress, 5320 bool aWait, bool aNotify)5394 bool aWait, bool aNotify) 5321 5395 { 5322 5396 AssertReturn(aProgress != NULL || aWait == true, E_FAIL); … … 5347 5421 /** @todo r=klaus would be great if this could be moved to the async 5348 5422 * part of the operation as it can take quite a while */ 5349 if (m->queryInfoRunning) 5350 { 5351 while (m->queryInfoRunning) 5352 { 5353 alock.release(); 5354 autoCaller.release(); 5355 treelock.release(); 5356 /* Must not hold the media tree lock or the object lock, as 5357 * Medium::i_queryInfo needs this lock and thus we would run 5358 * into a deadlock here. */ 5359 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5360 Assert(!isWriteLockOnCurrentThread()); 5361 { 5362 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 5363 } 5364 treelock.acquire(); 5365 autoCaller.add(); 5366 AssertComRCThrowRC(autoCaller.rc()); 5367 alock.acquire(); 5368 } 5423 while (m->queryInfoRunning) 5424 { 5425 alock.release(); 5426 autoCaller.release(); 5427 treelock.release(); 5428 /* Must not hold the media tree lock or the object lock, as 5429 * Medium::i_queryInfo needs this lock and thus we would run 5430 * into a deadlock here. */ 5431 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5432 Assert(!isWriteLockOnCurrentThread()); 5433 { 5434 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 5435 } 5436 treelock.acquire(); 5437 autoCaller.add(); 5438 AssertComRCThrowRC(autoCaller.rc()); 5439 alock.acquire(); 5369 5440 } 5370 5441
Note:
See TracChangeset
for help on using the changeset viewer.