summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2003-06-09 19:37:14 +0000
committerAlan Cox <alc@FreeBSD.org>2003-06-09 19:37:14 +0000
commit06fa71cdccac8d337b5f9f5b0485da28c3662877 (patch)
treea539ea041e6e803b51d9059c3b9341d47812ad35 /sys/kern/kern_exec.c
parent23b03a12742b664c03d37443c9e2188533c31d74 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index e9789b9cae08..5dd8d6ec40dc 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -749,18 +749,23 @@ exec_map_first_page(imgp)
VOP_GETVOBJECT(imgp->vp, &object);
VM_OBJECT_LOCK(object);
ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
- VM_OBJECT_UNLOCK(object);
+ vm_page_lock_queues();
if ((ma[0]->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
+ vm_page_unlock_queues();
initial_pagein = VM_INITIAL_PAGEIN;
if (initial_pagein > object->size)
initial_pagein = object->size;
for (i = 1; i < initial_pagein; i++) {
if ((ma[i] = vm_page_lookup(object, i)) != NULL) {
- if ((ma[i]->flags & PG_BUSY) || ma[i]->busy)
+ vm_page_lock_queues();
+ if ((ma[i]->flags & PG_BUSY) || ma[i]->busy) {
+ vm_page_unlock_queues();
break;
- if (ma[i]->valid)
+ }
+ if (ma[i]->valid) {
+ vm_page_unlock_queues();
break;
- vm_page_lock_queues();
+ }
vm_page_busy(ma[i]);
vm_page_unlock_queues();
} else {
@@ -771,22 +776,23 @@ exec_map_first_page(imgp)
}
}
initial_pagein = i;
-
+ VM_OBJECT_UNLOCK(object); /* XXX */
rv = vm_pager_get_pages(object, ma, initial_pagein, 0);
+ VM_OBJECT_LOCK(object); /* XXX */
ma[0] = vm_page_lookup(object, 0);
-
+ vm_page_lock_queues();
if ((rv != VM_PAGER_OK) || (ma[0] == NULL) ||
(ma[0]->valid == 0)) {
if (ma[0]) {
- vm_page_lock_queues();
pmap_remove_all(ma[0]);
vm_page_free(ma[0]);
- vm_page_unlock_queues();
}
+ vm_page_unlock_queues();
+ VM_OBJECT_UNLOCK(object);
return (EIO);
}
}
- vm_page_lock_queues();
+ VM_OBJECT_UNLOCK(object);
vm_page_wire(ma[0]);
vm_page_wakeup(ma[0]);
vm_page_unlock_queues();