summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_bio.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-11-29 01:59:20 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-11-29 01:59:20 +0000
commit9cc42e5abb54cc95f0b1a1c58a0f0119d2cfc0f2 (patch)
treebd609d6686b88df61e13f5583b881604e9258edc /sys/nfs/nfs_bio.c
parentd49e53545f99dbffcb72bfb0a9741bad9ed51adb (diff)
Correctly handle b_vp with bgetvp and brelvp in {get,put}pages.
Prevents panics caused by vnodes being recycled under our feet.
Diffstat (limited to 'sys/nfs/nfs_bio.c')
-rw-r--r--sys/nfs/nfs_bio.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index 42b25763a88..74c994def2a 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.25 2001/11/27 05:27:12 art Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.26 2001/11/29 01:59:19 art Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -757,7 +757,8 @@ nfs_getpages(v)
mbp->b_resid = mbp->b_bcount = bytes;
mbp->b_flags = B_BUSY|B_READ| (async ? B_CALL|B_ASYNC : 0);
mbp->b_iodone = uvm_aio_biodone;
- mbp->b_vp = vp;
+ mbp->b_vp = NULL;
+ bgetvp(vp, mbp);
mbp->b_proc = NULL; /* XXXUBC */
LIST_INIT(&mbp->b_dep);
@@ -864,6 +865,9 @@ loopdone:
error = biowait(mbp);
}
s = splbio();
+ if (mbp->b_vp != NULL) {
+ brelvp(mbp);
+ }
pool_put(&bufpool, mbp);
splx(s);
uvm_pagermapout(kva, npages);
@@ -1047,7 +1051,8 @@ nfs_putpages(v)
(async ? B_CALL|B_ASYNC : 0) |
(curproc == uvm.pagedaemon_proc ? B_PDAEMON : 0);
mbp->b_iodone = uvm_aio_biodone;
- mbp->b_vp = vp;
+ mbp->b_vp = NULL;
+ bgetvp(vp, mbp);
mbp->b_proc = NULL; /* XXXUBC */
LIST_INIT(&mbp->b_dep);
@@ -1109,8 +1114,10 @@ nfs_putpages(v)
}
s = splbio();
- if (mbp->b_vp)
+ if (mbp->b_vp) {
vwakeup(mbp->b_vp);
+ brelvp(mbp);
+ }
pool_put(&bufpool, mbp);
splx(s);