Fix a long standing bug that was made worse in r355765. When we are cowing a
authorjeff <jeff@FreeBSD.org>
Fri, 17 Jan 2020 03:44:04 +0000 (03:44 +0000)
committerjeff <jeff@FreeBSD.org>
Fri, 17 Jan 2020 03:44:04 +0000 (03:44 +0000)
commit272010ae27e99df0ea1ec84f2f62019c5b9d9ba5
tree663eb6e06b8b7d210d59c482b40b351a6b05fece
parent3de00b22c6950ed73ec63a1768cbce63dcfd577f
Fix a long standing bug that was made worse in r355765.  When we are cowing a
page that was previously mapped read-only it exists in pmap until pmap_enter()
returns.  However, we held no reference to the original page after the copy
was complete.  This allowed vm_object_scan_all_shadowed() to collapse an
object that still had pages mapped.  To resolve this, add another page pointer
to the faultstate so we can keep the page xbusy until we're done with
pmap_enter().  Handle busy pages in scan_all_shadowed.  This is already done
in vm_object_collapse_scan().

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D23155
sys/vm/vm_fault.c
sys/vm/vm_object.c