summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-09-18 15:57:41 +0000
committerdyson <dyson@FreeBSD.org>1996-09-18 15:57:41 +0000
commit778e4b0932dc45b8dd3748fd0872aa72809b26b3 (patch)
treec53156da166f9788143b7ef27e387df96fb9122e
parentbd03b16ed6d4618df559c37a527bc5456031889c (diff)
downloadFreeBSD-src-778e4b0932dc45b8dd3748fd0872aa72809b26b3.zip
FreeBSD-src-778e4b0932dc45b8dd3748fd0872aa72809b26b3.tar.gz
Add needed spl protection, and some minor cleanups in vfs_vmio_release.
Submitted by: Peter Wemm <peter@spinner.dialix.com> and me.
-rw-r--r--sys/kern/vfs_bio.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a72198a..2513bf6 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: vfs_bio.c,v 1.98 1996/09/08 20:44:20 dyson Exp $
+ * $Id: vfs_bio.c,v 1.100 1996/09/14 04:40:33 dyson Exp $
*/
/*
@@ -313,6 +313,11 @@ bwrite(struct buf * bp)
curproc->p_stats->p_ru.ru_oublock++;
VOP_STRATEGY(bp);
+ /*
+ * It is possible that the buffer is reused
+ * before this point if B_ASYNC... What to do?
+ */
+
/* if ((bp->b_flags & B_ASYNC) == 0) { */
if ((oldflags & B_ASYNC) == 0) {
int rtval = biowait(bp);
@@ -618,20 +623,24 @@ vfs_vmio_release(bp)
struct buf *bp;
{
int i;
- vm_page_t m;
for (i = 0; i < bp->b_npages; i++) {
+ int s;
+ vm_page_t m;
+
m = bp->b_pages[i];
bp->b_pages[i] = NULL;
+
+ s = splbio();
while ((m->flags & PG_BUSY) || (m->busy != 0)) {
m->flags |= PG_WANTED;
tsleep(m, PVM, "vmiorl", 0);
}
+ splx(s);
vm_page_unwire(m);
if (m->wire_count == 0) {
-
if (m->flags & PG_WANTED) {
m->flags &= ~PG_WANTED;
wakeup(m);
@@ -645,15 +654,12 @@ vfs_vmio_release(bp)
*/
if ((vm_swap_size == 0) ||
(cnt.v_free_count < cnt.v_free_min)) {
- if ((m->dirty == 0) &&
- (m->hold_count == 0) &&
- (m->busy == 0))
+ if ((m->dirty == 0) && (m->hold_count == 0))
vm_page_cache(m);
else
vm_page_deactivate(m);
}
- } else if ((m->hold_count == 0) &&
- (m->busy == 0)) {
+ } else if (m->hold_count == 0) {
vm_page_protect(m, VM_PROT_NONE);
vm_page_free(m);
}
OpenPOWER on IntegriCloud