diff options
Diffstat (limited to 'sys/uvm/uvm_vnode.c')
-rw-r--r-- | sys/uvm/uvm_vnode.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c index 80eba8cb92a..dbba98b4934 100644 --- a/sys/uvm/uvm_vnode.c +++ b/sys/uvm/uvm_vnode.c @@ -1,11 +1,6 @@ -/* $OpenBSD: uvm_vnode.c,v 1.3 1999/07/08 00:54:29 deraadt Exp $ */ -/* $NetBSD: uvm_vnode.c,v 1.18 1999/01/29 12:56:17 bouyer Exp $ */ +/* $NetBSD: uvm_vnode.c,v 1.22 1999/03/25 18:48:56 mrg Exp $ */ /* - * XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE! - * >>>USE AT YOUR OWN RISK, WORK IS NOT FINISHED<<< - */ -/* * Copyright (c) 1997 Charles D. Cranor and Washington University. * Copyright (c) 1991, 1993 * The Regents of the University of California. @@ -118,7 +113,6 @@ static boolean_t uvn_releasepg __P((struct vm_page *, struct uvm_pagerops uvm_vnodeops = { uvn_init, - uvn_attach, uvn_reference, uvn_detach, NULL, /* no specialized fault routine required */ @@ -292,12 +286,12 @@ uvn_attach(arg, accessprot) */ #ifdef DEBUG if (vp->v_type == VBLK) - printf("used_vnode_size = %qu\n", used_vnode_size); + printf("used_vnode_size = %qu\n", (long long)used_vnode_size); #endif if (used_vnode_size > (vaddr_t) -PAGE_SIZE) { #ifdef DEBUG printf("uvn_attach: vn %p size truncated %qx->%x\n", vp, - used_vnode_size, -PAGE_SIZE); + (long long)used_vnode_size, -PAGE_SIZE); #endif used_vnode_size = (vaddr_t) -PAGE_SIZE; } @@ -1458,7 +1452,7 @@ uvn_get(uobj, offset, pps, npagesp, centeridx, access_type, advice, flags) if (ptmp == NULL) { ptmp = uvm_pagealloc(uobj, current_offset, - NULL); /* alloc */ + NULL, 0); /* out of RAM? */ if (ptmp == NULL) { @@ -1699,17 +1693,31 @@ uvn_io(uvn, pps, npages, flags, rw) UVMHIST_LOG(maphist, "calling VOP",0,0,0,0); + /* + * This process may already have this vnode locked, if we faulted in + * copyin() or copyout() on a region backed by this vnode + * while doing I/O to the vnode. If this is the case, don't + * panic.. instead, return the error to the user. + * + * XXX this is a stopgap to prevent a panic. + * Ideally, this kind of operation *should* work. + */ + result = 0; if ((uvn->u_flags & UVM_VNODE_VNISLOCKED) == 0) - vn_lock(vn, LK_EXCLUSIVE | LK_RETRY, curproc /*XXX*/); - /* NOTE: vnode now locked! */ + result = vn_lock(vn, LK_EXCLUSIVE | LK_RETRY, curproc /*XXX*/); - if (rw == UIO_READ) - result = VOP_READ(vn, &uio, 0, curproc->p_ucred); - else - result = VOP_WRITE(vn, &uio, 0, curproc->p_ucred); + if (result == 0) { + /* NOTE: vnode now locked! */ - if ((uvn->u_flags & UVM_VNODE_VNISLOCKED) == 0) - VOP_UNLOCK(vn, 0, curproc /*XXX*/); + if (rw == UIO_READ) + result = VOP_READ(vn, &uio, 0, curproc->p_ucred); + else + result = VOP_WRITE(vn, &uio, 0, curproc->p_ucred); + + if ((uvn->u_flags & UVM_VNODE_VNISLOCKED) == 0) + VOP_UNLOCK(vn, 0, curproc /*XXX*/); + } + /* NOTE: vnode now unlocked (unless vnislocked) */ UVMHIST_LOG(maphist, "done calling VOP",0,0,0,0); @@ -1921,7 +1929,8 @@ uvm_vnp_setsize(vp, newsize) if (newsize > (vaddr_t) -PAGE_SIZE) { #ifdef DEBUG printf("uvm_vnp_setsize: vn %p size truncated " - "%qx->%lx\n", vp, newsize, (vaddr_t)-PAGE_SIZE); + "%qx->%lx\n", vp, (long long)newsize, + (vaddr_t)-PAGE_SIZE); #endif newsize = (vaddr_t)-PAGE_SIZE; } |