* FlushAndRemoveAllPages() cannot call WriteModified(), as it must be called

with the VMCache lock held, and WriteModified() locks itself.
* Added an assertion that the lock is held when calling that method.
* This fixes a KDL as soon as you would have used O_NOCACHE with a file that
  had already some pages read in.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26864 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-07 17:36:01 +00:00
parent 7c7dc861e8
commit f93c785026
+6 -3
View File
@@ -796,14 +796,17 @@ VMCache::Resize(off_t newSize)
}
/*! You have to call this function with the VMCache lock held. */
status_t
VMCache::FlushAndRemoveAllPages()
{
ASSERT_LOCKED_MUTEX(&fLock);
while (page_count > 0) {
// write back modified pages
status_t error = WriteModified();
if (error != B_OK)
return error;
status_t status = vm_page_write_modified_pages(this);
if (status != B_OK)
return status;
// remove pages
for (VMCachePagesTree::Iterator it = pages.GetIterator();