summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-06-11 19:13:59 +0000
committeralc <alc@FreeBSD.org>2002-06-11 19:13:59 +0000
commitc3f3773d48397d940cc79e01897274a6eb110dbf (patch)
tree932deae49bbdf26ca9ef8c39bcb718702977bf56 /sys
parent5217090ee45857447f7ff5e0d1d9f193b68b4adb (diff)
downloadFreeBSD-src-c3f3773d48397d940cc79e01897274a6eb110dbf.zip
FreeBSD-src-c3f3773d48397d940cc79e01897274a6eb110dbf.tar.gz
o Properly handle a failure by vm_fault_wire() or vm_fault_user_wire()
in vm_map_wire(). o Make two white-space changes in vm_map_wire(). Reviewed by: tegge
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_map.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index f762698..9d182c1 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -1650,7 +1650,7 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,
*/
}
vm_map_lock(map);
- if (last_timestamp+1 != map->timestamp) {
+ if (last_timestamp + 1 != map->timestamp) {
/*
* Look again for the entry because the map was
* modified while it was unlocked.
@@ -1704,7 +1704,7 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,
else
rv = vm_fault_wire(map, saved_start, saved_end);
vm_map_lock(map);
- if (last_timestamp+1 != map->timestamp) {
+ if (last_timestamp + 1 != map->timestamp) {
/*
* Look again for the entry because the map was
* modified while it was unlocked. The entry
@@ -1719,14 +1719,24 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,
else
first_entry = NULL;
entry = tmp_entry;
- while (entry->end < saved_end)
+ while (entry->end < saved_end) {
+ if (rv != KERN_SUCCESS) {
+ KASSERT(entry->wired_count == 1,
+ ("vm_map_wire: bad count"));
+ entry->wired_count = -1;
+ }
entry = entry->next;
+ }
}
last_timestamp = map->timestamp;
if (rv != KERN_SUCCESS) {
+ KASSERT(entry->wired_count == 1,
+ ("vm_map_wire: bad count"));
/*
- * XXX
+ * Assign an out-of-range value to represent
+ * the failure to wire this entry.
*/
+ entry->wired_count = -1;
end = entry->end;
goto done;
}
@@ -1757,6 +1767,12 @@ done:
if (rv == KERN_SUCCESS) {
if (user_wire)
entry->eflags |= MAP_ENTRY_USER_WIRED;
+ } else if (entry->wired_count == -1) {
+ /*
+ * Wiring failed on this entry. Thus, unwiring is
+ * unnecessary.
+ */
+ entry->wired_count = 0;
} else {
if (!user_wire || (entry->wired_count == 1 &&
(entry->eflags & MAP_ENTRY_USER_WIRED) == 0))
OpenPOWER on IntegriCloud