mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-27 11:55:06 +00:00
Clean up the handling of errors from vm_pager_get_pages(). Mostly, this
cleanup consists of fixes to comments. However, there is one change to code: Remove special-case handling of errors involving the kernel map. We do not perform I/O on the kernel map, so there is no need for this special case. Reviewed by: kib (an earlier version)
This commit is contained in:
parent
d3683d27cf
commit
521ddf39cb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300225
@ -657,48 +657,40 @@ RetryFault:;
|
||||
hardfault++;
|
||||
break; /* break to PAGE HAS BEEN FOUND */
|
||||
}
|
||||
/*
|
||||
* Remove the bogus page (which does not exist at this
|
||||
* object/offset); before doing so, we must get back
|
||||
* our object lock to preserve our invariant.
|
||||
*
|
||||
* Also wake up any other process that may want to bring
|
||||
* in this page.
|
||||
*
|
||||
* If this is the top-level object, we must leave the
|
||||
* busy page to prevent another process from rushing
|
||||
* past us, and inserting the page in that object at
|
||||
* the same time that we are.
|
||||
*/
|
||||
if (rv == VM_PAGER_ERROR)
|
||||
printf("vm_fault: pager read error, pid %d (%s)\n",
|
||||
curproc->p_pid, curproc->p_comm);
|
||||
|
||||
/*
|
||||
* Data outside the range of the pager or an I/O error
|
||||
* If an I/O error occurred or the requested page was
|
||||
* outside the range of the pager, clean up and return
|
||||
* an error.
|
||||
*/
|
||||
/*
|
||||
* XXX - the check for kernel_map is a kludge to work
|
||||
* around having the machine panic on a kernel space
|
||||
* fault w/ I/O error.
|
||||
*/
|
||||
if (((fs.map != kernel_map) && (rv == VM_PAGER_ERROR)) ||
|
||||
(rv == VM_PAGER_BAD)) {
|
||||
if (rv == VM_PAGER_ERROR || rv == VM_PAGER_BAD) {
|
||||
vm_page_lock(fs.m);
|
||||
vm_page_free(fs.m);
|
||||
vm_page_unlock(fs.m);
|
||||
fs.m = NULL;
|
||||
unlock_and_deallocate(&fs);
|
||||
return ((rv == VM_PAGER_ERROR) ? KERN_FAILURE : KERN_PROTECTION_FAILURE);
|
||||
return (rv == VM_PAGER_ERROR ? KERN_FAILURE :
|
||||
KERN_PROTECTION_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* The requested page does not exist at this object/
|
||||
* offset. Remove the invalid page from the object,
|
||||
* waking up anyone waiting for it, and continue on to
|
||||
* the next object. However, if this is the top-level
|
||||
* object, we must leave the busy page in place to
|
||||
* prevent another process from rushing past us, and
|
||||
* inserting the page in that object at the same time
|
||||
* that we are.
|
||||
*/
|
||||
if (fs.object != fs.first_object) {
|
||||
vm_page_lock(fs.m);
|
||||
vm_page_free(fs.m);
|
||||
vm_page_unlock(fs.m);
|
||||
fs.m = NULL;
|
||||
/*
|
||||
* XXX - we cannot just fall out at this
|
||||
* point, m has been freed and is invalid!
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user