summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-10-04 19:23:29 +0000
committeralc <alc@FreeBSD.org>2003-10-04 19:23:29 +0000
commit7c11eaebacba51be590dbfcfc8a8dcc8513a0eb2 (patch)
tree646f064fe12e4424b020ea78bf8c3b0e4d739b52 /sys/kern/vfs_bio.c
parentfa0f25a35968ab0f76aa53390c80c563bf400f47 (diff)
downloadFreeBSD-src-7c11eaebacba51be590dbfcfc8a8dcc8513a0eb2.zip
FreeBSD-src-7c11eaebacba51be590dbfcfc8a8dcc8513a0eb2.tar.gz
- Extend the scope the vm object lock to cover calls to
vm_page_is_valid(). - Assert that the lock on the containing vm object is held in vm_page_is_valid().
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 79bfd4b..8794440 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -380,6 +380,7 @@ vfs_buf_test_cache(struct buf *bp,
{
GIANT_REQUIRED;
+ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
if (bp->b_flags & B_CACHE) {
int base = (foff + off) & PAGE_MASK;
if (vm_page_is_valid(m, base, size) == 0)
@@ -2235,10 +2236,9 @@ inmem(struct vnode * vp, daddr_t blkno)
size = vp->v_mount->mnt_stat.f_iosize;
off = (vm_ooffset_t)blkno * (vm_ooffset_t)vp->v_mount->mnt_stat.f_iosize;
+ VM_OBJECT_LOCK(obj);
for (toff = 0; toff < vp->v_mount->mnt_stat.f_iosize; toff += tinc) {
- VM_OBJECT_LOCK(obj);
m = vm_page_lookup(obj, OFF_TO_IDX(off + toff));
- VM_OBJECT_UNLOCK(obj);
if (!m)
goto notinmem;
tinc = size;
@@ -2248,9 +2248,11 @@ inmem(struct vnode * vp, daddr_t blkno)
(vm_offset_t) ((toff + off) & PAGE_MASK), tinc) == 0)
goto notinmem;
}
+ VM_OBJECT_UNLOCK(obj);
return 1;
notinmem:
+ VM_OBJECT_UNLOCK(obj);
return (0);
}
@@ -2902,7 +2904,6 @@ allocbuf(struct buf *bp, int size)
bp->b_pages[bp->b_npages] = m;
++bp->b_npages;
}
- VM_OBJECT_UNLOCK(obj);
/*
* Step 2. We've loaded the pages into the buffer,
@@ -2941,6 +2942,7 @@ allocbuf(struct buf *bp, int size)
toff += tinc;
tinc = PAGE_SIZE;
}
+ VM_OBJECT_UNLOCK(obj);
/*
* Step 3, fixup the KVM pmap. Remember that
OpenPOWER on IntegriCloud