diff options
author | alc <alc@FreeBSD.org> | 2003-10-19 20:39:06 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-10-19 20:39:06 +0000 |
commit | 676085d67110550e1f32ca4a1a3b4b1faf055dc5 (patch) | |
tree | 1324b8cab2c5d03ed189130af891a291f0b2ca0d /sys/kern | |
parent | b7c9250fa7b7753965f160c1e05ed1a7b6a99039 (diff) | |
download | FreeBSD-src-676085d67110550e1f32ca4a1a3b4b1faf055dc5.zip FreeBSD-src-676085d67110550e1f32ca4a1a3b4b1faf055dc5.tar.gz |
- Add vm object locking to vfs_clean_pages() and vfs_bio_set_validclean().
This is to synchronize access to the vm page's valid field by
vm_page_set_validclean().
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 45c30f7..2fcee71 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3446,14 +3446,13 @@ vfs_clean_pages(struct buf * bp) { int i; - GIANT_REQUIRED; - if (bp->b_flags & B_VMIO) { vm_ooffset_t foff; foff = bp->b_offset; KASSERT(bp->b_offset != NOOFFSET, ("vfs_clean_pages: no buffer offset")); + VM_OBJECT_LOCK(bp->b_object); vm_page_lock_queues(); for (i = 0; i < bp->b_npages; i++) { vm_page_t m = bp->b_pages[i]; @@ -3467,6 +3466,7 @@ vfs_clean_pages(struct buf * bp) foff = noff; } vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(bp->b_object); } } @@ -3495,6 +3495,7 @@ vfs_bio_set_validclean(struct buf *bp, int base, int size) base += (bp->b_offset & PAGE_MASK); n = PAGE_SIZE - (base & PAGE_MASK); + VM_OBJECT_LOCK(bp->b_object); vm_page_lock_queues(); for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { vm_page_t m = bp->b_pages[i]; @@ -3508,6 +3509,7 @@ vfs_bio_set_validclean(struct buf *bp, int base, int size) n = PAGE_SIZE; } vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(bp->b_object); } } |