Correct two errors in PG_BUSY management by vm_page_cowfault(). Both

errors are in rarely executed paths.
1. Each time the retry_alloc path is taken, the PG_BUSY must be set again.
   Otherwise vm_page_remove() panics.
2. There is no need to set PG_BUSY on the newly allocated page before
   freeing it.  The page already has PG_BUSY set by vm_page_alloc().
   Setting it again could cause an assertion failure.

MFC after: 2 weeks
This commit is contained in:
Alan Cox 2004-10-18 08:11:59 +00:00
parent e1d0efc09d
commit 1e96d2a217
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136655

View File

@ -1656,9 +1656,9 @@ vm_page_cowfault(vm_page_t m)
object = m->object;
pindex = m->pindex;
vm_page_busy(m);
retry_alloc:
vm_page_busy(m);
vm_page_remove(m);
mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
if (mnew == NULL) {
@ -1677,7 +1677,6 @@ vm_page_cowfault(vm_page_t m)
* waiting to allocate a page. If so, put things back
* the way they were
*/
vm_page_busy(mnew);
vm_page_free(mnew);
vm_page_insert(m, object, pindex);
} else { /* clear COW & copy page */