diff options
author | kib <kib@FreeBSD.org> | 2013-04-09 10:04:10 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-04-09 10:04:10 +0000 |
commit | d5061cb1cdbcb13fa0ba99ab9840c95565673b91 (patch) | |
tree | 4e73314993b71443dcdd41f687ed8bfceb02d9c0 /sys/vm/vm_map.c | |
parent | 99469b7e8a92312f6404016ff3bba73d170c64be (diff) | |
download | FreeBSD-src-d5061cb1cdbcb13fa0ba99ab9840c95565673b91.zip FreeBSD-src-d5061cb1cdbcb13fa0ba99ab9840c95565673b91.tar.gz |
Fix the assertions for the state of the object under the map entry
with the MAP_ENTRY_VN_WRITECNT flag:
- Move the assertion that verifies the state of the v_writecount and
vnp.writecount, under the block where the object is locked.
- Check that the object type is OBJT_VNODE before asserting.
Reported by: avg
Reviewed by: alc
MFC after: 1 week
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r-- | sys/vm/vm_map.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 72d3983..933b0e1 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -3160,6 +3160,22 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_charge) object->charge = old_entry->end - old_entry->start; old_entry->cred = NULL; } + + /* + * Assert the correct state of the vnode + * v_writecount while the object is locked, to + * not relock it later for the assertion + * correctness. + */ + if (old_entry->eflags & MAP_ENTRY_VN_WRITECNT && + object->type == OBJT_VNODE) { + KASSERT(((struct vnode *)object->handle)-> + v_writecount > 0, + ("vmspace_fork: v_writecount %p", object)); + KASSERT(object->un_pager.vnp.writemappings > 0, + ("vmspace_fork: vnp.writecount %p", + object)); + } VM_OBJECT_WUNLOCK(object); /* @@ -3171,12 +3187,6 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_charge) MAP_ENTRY_IN_TRANSITION); new_entry->wired_count = 0; if (new_entry->eflags & MAP_ENTRY_VN_WRITECNT) { - object = new_entry->object.vm_object; - KASSERT(((struct vnode *)object->handle)-> - v_writecount > 0, - ("vmspace_fork: v_writecount")); - KASSERT(object->un_pager.vnp.writemappings > 0, - ("vmspace_fork: vnp.writecount")); vnode_pager_update_writecount(object, new_entry->start, new_entry->end); } |