vm_fault: update pred lock acq in copy_entry

In vm_fault_copy_entry, variable 'mpred' is invalided as the
predecessor of the next page to be inserted when an allocation failure
leads to lock release and reacquisition.  Recompute it in that case.

Reported by:    markj
Reviewed by:    markj
Fixes:  vm_page: expose page_alloc_after 6b33d9dc46
Differential Revision:  https://reviews.freebsd.org/D49521
This commit is contained in:
Doug Moore 2025-03-27 05:39:44 -05:00
parent 03dfb8d021
commit 6d6c97fb72

View file

@ -2199,14 +2199,16 @@ again:
/*
* Allocate a page in the destination object.
*/
dst_m = vm_page_alloc_after(dst_object, (src_object ==
dst_object ? src_pindex : 0) + dst_pindex,
pindex = (src_object == dst_object ? src_pindex : 0) +
dst_pindex;
dst_m = vm_page_alloc_after(dst_object, pindex,
VM_ALLOC_NORMAL, mpred);
if (dst_m == NULL) {
VM_OBJECT_WUNLOCK(dst_object);
VM_OBJECT_RUNLOCK(object);
vm_wait(dst_object);
VM_OBJECT_WLOCK(dst_object);
mpred = vm_page_mpred(src_object, pindex);
goto again;
}