diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -2122,7 +2122,6 @@ break; } } - VM_OBJECT_WUNLOCK(dst_object); /* * Enter it in the pmap. If a wired, copy-on-write @@ -2137,15 +2136,15 @@ * backing pages. */ if (vm_page_all_valid(dst_m)) { + VM_OBJECT_WUNLOCK(dst_object); pmap_enter(dst_map->pmap, vaddr, dst_m, prot, access | (upgrade ? PMAP_ENTER_WIRED : 0), 0); + VM_OBJECT_WLOCK(dst_object); } /* * Mark it no longer busy, and put it on the active list. */ - VM_OBJECT_WLOCK(dst_object); - if (upgrade) { if (src_m != dst_m) { vm_page_unwire(src_m, PQ_INACTIVE);