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
This commit is contained in:
parent
99469b7e8a
commit
d5061cb1cd
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user