MFC revisions 1.307 and 1.308

Consider the zero-copy transmission of a page that was wired by mlock(2).
  If a copy-on-write fault occurs on the page, the new copy should inherit
  a part of the original page's wire count.

  If a physical page is mapped by two or more virtual addresses, transmitted
  by the zero-copy sockets method, and written to before the transmission
  completes, we need to destroy all of the existing mappings to the page,
  not just the one that we fault on.  Otherwise, the mappings will no longer
  be to the same page and changes made through one of the mappings will not
  be visible through the others.
This commit is contained in:
alc 2005-11-13 07:38:15 +00:00
parent 8dfd629a38
commit bad48fafaa

View File

@ -1646,6 +1646,7 @@ vm_page_cowfault(vm_page_t m)
pindex = m->pindex; pindex = m->pindex;
retry_alloc: retry_alloc:
pmap_remove_all(m);
vm_page_remove(m); vm_page_remove(m);
mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL); mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
if (mnew == NULL) { if (mnew == NULL) {
@ -1672,6 +1673,8 @@ vm_page_cowfault(vm_page_t m)
mnew->valid = VM_PAGE_BITS_ALL; mnew->valid = VM_PAGE_BITS_ALL;
vm_page_dirty(mnew); vm_page_dirty(mnew);
vm_page_flag_clear(mnew, PG_BUSY); vm_page_flag_clear(mnew, PG_BUSY);
mnew->wire_count = m->wire_count - m->cow;
m->wire_count = m->cow;
} }
} }