mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 14:08:21 +00:00
vmmcache: redo how vnode locking is expected
This commit is contained in:
+1
-2
@@ -581,9 +581,8 @@ bool vmm_pagefault(void *addr, bool user, int actions) {
|
||||
} else {
|
||||
// cacheable vnode
|
||||
page_t *res = NULL;
|
||||
VOP_LOCK(range->vnode);
|
||||
int error = vmmcache_getpage(range->vnode, range->offset + mapoffset, &res);
|
||||
VOP_UNLOCK(range->vnode);
|
||||
|
||||
if (error == ENXIO || error == ENOMEM) {
|
||||
if (error == ENOMEM)
|
||||
printf("vmm: out of memory to handle getpage (sending SIGBUS)\n");
|
||||
|
||||
@@ -102,7 +102,6 @@ static void removepage(page_t *page) {
|
||||
--vmmcache_cachedpages;
|
||||
}
|
||||
|
||||
// vnode expected locked
|
||||
int vmmcache_getpage(vnode_t *vnode, uintmax_t offset, page_t **res) {
|
||||
__assert(vnode->type == V_TYPE_REGULAR || vnode->type == V_TYPE_BLKDEV);
|
||||
__assert((offset % PAGE_SIZE) == 0);
|
||||
@@ -164,7 +163,9 @@ int vmmcache_getpage(vnode_t *vnode, uintmax_t offset, page_t **res) {
|
||||
|
||||
RELEASE_LOCK();
|
||||
|
||||
VOP_LOCK(vnode);
|
||||
int error = VOP_GETPAGE(vnode, offset, newpage);
|
||||
VOP_UNLOCK(vnode);
|
||||
|
||||
if (error) {
|
||||
// an error happened with GETPAGE, remove the page from the cache,
|
||||
|
||||
Reference in New Issue
Block a user