From af09f123d3df57e2fd9fef9ac9edbfe55c61a431 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 11 Dec 2011 16:54:13 +0100 Subject: [PATCH] Create the right cache type ([non-]swappable) on copy on write. When forking a team, copy on write areas (and therefore caches) are created for all the areas in the parent team, but they were always created as swappable. If the parent team had some B_FULL_LOCK areas, which aren't swappable, the wrong type of cache would be created which lead to them not being mergeable later on (causing a panic). Comments about a possibly cleaner way to figure out the cache type would be welcome. --- src/system/kernel/vm/vm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 75bbc80165..a03d690a51 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -55,6 +55,7 @@ #include "VMAddressSpaceLocking.h" #include "VMAnonymousCache.h" +#include "VMAnonymousNoSwapCache.h" #include "IORequest.h" @@ -2300,7 +2301,8 @@ vm_copy_on_write_area(VMCache* lowerCache, // create an anonymous cache status_t status = VMCacheFactory::CreateAnonymousCache(upperCache, false, 0, - 0, true, VM_PRIORITY_USER); + 0, dynamic_cast(lowerCache) == NULL, + VM_PRIORITY_USER); if (status != B_OK) return status;