VMCache::RemoveArea(): Don't release the store reference while having

the cache locked, since it enters the VFS and might reenter VMCache,
thus causing deadlocks. Fixes bug #2577.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26849 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-08-06 23:02:59 +00:00
parent a5b8a7dfc9
commit 993a8b776f

View File

@ -667,6 +667,12 @@ VMCache::RemoveArea(vm_area* area)
T(RemoveArea(this, area));
// We release the store reference first, since otherwise we would reverse
// the locking order or even deadlock ourselves (... -> free_vnode() -> ...
// -> bfs_remove_vnode() -> ... -> file_cache_set_size() -> mutex_lock()).
// Also cf. _RemoveConsumer().
ReleaseStoreRef();
AutoLocker<VMCache> locker(this);
if (area->cache_prev)
@ -676,8 +682,6 @@ VMCache::RemoveArea(vm_area* area)
if (areas == area)
areas = area->cache_next;
ReleaseStoreRef();
return B_OK;
}