diff options
author | alc <alc@FreeBSD.org> | 2003-04-28 05:40:45 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-04-28 05:40:45 +0000 |
commit | afa5d8b791a6e87a1fd1647989760f03a0fb1566 (patch) | |
tree | e3dd8e327af916cb0109522923458a750f603e2a /sys/kern/vfs_bio.c | |
parent | 72d436f39acc536214c41cd8862692e290e2f31c (diff) | |
download | FreeBSD-src-afa5d8b791a6e87a1fd1647989760f03a0fb1566.zip FreeBSD-src-afa5d8b791a6e87a1fd1647989760f03a0fb1566.tar.gz |
Finish the vm_object locking for this file, including holding the vm_object
lock when accessing the vm_object's flags or calling vm_page_lookup().
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 8006f99..0b4a643 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1317,7 +1317,8 @@ brelse(struct buf * bp) */ resid = bp->b_bufsize; foff = bp->b_offset; - + if (obj != NULL) + VM_OBJECT_LOCK(obj); for (i = 0; i < bp->b_npages; i++) { int had_bogus = 0; @@ -1364,7 +1365,8 @@ brelse(struct buf * bp) resid -= PAGE_SIZE - (foff & PAGE_MASK); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; } - + if (obj != NULL) + VM_OBJECT_UNLOCK(obj); if (bp->b_flags & (B_INVAL | B_RELBUF)) vfs_vmio_release(bp); @@ -2225,7 +2227,9 @@ inmem(struct vnode * vp, daddr_t blkno) off = (vm_ooffset_t)blkno * (vm_ooffset_t)vp->v_mount->mnt_stat.f_iosize; 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; @@ -2276,7 +2280,7 @@ vfs_setdirty(struct buf *bp) return; object = bp->b_pages[0]->object; - + VM_OBJECT_LOCK(object); if ((object->flags & OBJ_WRITEABLE) && !(object->flags & OBJ_MIGHTBEDIRTY)) printf("Warning: object %p writeable but not mightbedirty\n", object); if (!(object->flags & OBJ_WRITEABLE) && (object->flags & OBJ_MIGHTBEDIRTY)) @@ -2334,6 +2338,7 @@ vfs_setdirty(struct buf *bp) bp->b_dirtyend = eoffset; } } + VM_OBJECT_UNLOCK(object); } /* |