Lock the vm_object on entry to vm_object_vndeallocate().

This commit is contained in:
alc 2003-05-03 20:28:26 +00:00
parent 978f22b7c8
commit f9966ce9e8
2 changed files with 9 additions and 1 deletions

View File

@ -549,6 +549,7 @@ ffs_read(ap)
}
if (object) {
VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
}
if ((error == 0 || uio->uio_resid != orig_resid) &&
@ -613,6 +614,7 @@ ffs_write(ap)
uio->uio_offset = ip->i_size;
if ((ip->i_flags & APPEND) && uio->uio_offset != ip->i_size) {
if (object) {
VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
}
return (EPERM);
@ -634,6 +636,7 @@ ffs_write(ap)
if (uio->uio_offset < 0 ||
(u_int64_t)uio->uio_offset + uio->uio_resid > fs->fs_maxfilesize) {
if (object) {
VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
}
return (EFBIG);
@ -650,6 +653,7 @@ ffs_write(ap)
psignal(td->td_proc, SIGXFSZ);
PROC_UNLOCK(td->td_proc);
if (object) {
VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
}
return (EFBIG);
@ -774,6 +778,7 @@ ffs_write(ap)
error = UFS_UPDATE(vp, 1);
if (object) {
VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
}

View File

@ -399,6 +399,7 @@ vm_object_vndeallocate(vm_object_t object)
struct vnode *vp = (struct vnode *) object->handle;
GIANT_REQUIRED;
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
KASSERT(object->type == OBJT_VNODE,
("vm_object_vndeallocate: not a vnode object"));
KASSERT(vp != NULL, ("vm_object_vndeallocate: missing vp"));
@ -414,6 +415,7 @@ vm_object_vndeallocate(vm_object_t object)
mp_fixme("Unlocked vflag access.");
vp->v_vflag &= ~VV_TEXT;
}
VM_OBJECT_UNLOCK(object);
/*
* vrele may need a vop lock
*/
@ -440,8 +442,9 @@ vm_object_deallocate(vm_object_t object)
while (object != NULL) {
if (object->type == OBJT_VNODE) {
VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
vm_object_unlock(object);
mtx_unlock(&Giant);
return;
}