summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_fault.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index e443a00..a620576 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -310,11 +310,18 @@ RetryFault:;
int queue, s;
/*
- * check for page-based copy on write
+ * check for page-based copy on write.
+ * We check fs.object == fs.first_object so
+ * as to ensure the legacy COW mechanism is
+ * used when the page in question is part of
+ * a shadow object. Otherwise, vm_page_cowfault()
+ * removes the page from the backing object,
+ * which is not what we want.
*/
vm_page_lock_queues();
if ((fs.m->cow) &&
- (fault_type & VM_PROT_WRITE)) {
+ (fault_type & VM_PROT_WRITE) &&
+ (fs.object == fs.first_object)) {
s = splvm();
vm_page_cowfault(fs.m);
splx(s);
OpenPOWER on IntegriCloud