From 9d22ffbe844d371fd6665a5d60efa9309c994488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 20 Aug 2007 14:27:11 +0000 Subject: [PATCH] Fixed bug #1413: * vm_soft_fault() no longer touches the page source cache in case fault_get_page() failed. * fault_find_page() now unlocks and releases the cache if reading in a page failed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22016 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 491f71ba79..446d3b068a 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -3610,7 +3610,6 @@ fault_find_page(vm_translation_map *map, vm_cache *topCache, vm_store *store = cache->store; if (store->ops->has_page != NULL && store->ops->has_page(store, cacheOffset)) { - // insert a fresh page and mark it busy -- we're going to read it in page = vm_page_allocate_page(PAGE_STATE_FREE); vm_cache_insert_page(cache, page, cacheOffset); @@ -3644,13 +3643,14 @@ fault_find_page(vm_translation_map *map, vm_cache *topCache, vm_cache_remove_page(cache, page); vm_page_set_state(page, PAGE_STATE_FREE); + mutex_unlock(&cache->lock); + vm_cache_release_ref(cache); return status; } // mark the page unbusy again page->state = PAGE_STATE_ACTIVE; busyCondition.Unpublish(); - break; } @@ -4036,12 +4036,13 @@ vm_soft_fault(addr_t originalAddress, bool isWrite, bool isUser) newProtection &= ~(B_WRITE_AREA | B_KERNEL_WRITE_AREA); vm_map_page(area, page, address, newProtection); + + mutex_unlock(&pageSource->lock); + vm_cache_release_ref(pageSource); } atomic_add(&area->no_cache_change, -1); - mutex_unlock(&pageSource->lock); - vm_cache_release_ref(pageSource); if (copiedPageSource) vm_cache_release_ref(copiedPageSource);