Lock the vm_object when performing vm_pager_deallocate().

This commit is contained in:
Alan Cox 2003-05-06 02:45:28 +00:00
parent a260623c5f
commit 658ad5fff5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114774
5 changed files with 12 additions and 7 deletions

View File

@ -657,11 +657,11 @@ vop_stddestroyvobject(ap)
else
VM_OBJECT_UNLOCK(obj);
} else {
VM_OBJECT_UNLOCK(obj);
/*
* Woe to the process that tries to page now :-).
*/
vm_pager_deallocate(obj);
VM_OBJECT_UNLOCK(obj);
}
return (0);
}

View File

@ -428,9 +428,8 @@ swap_pager_dealloc(object)
}
mtx_unlock(&sw_alloc_mtx);
VM_OBJECT_LOCK(object);
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
vm_object_pip_wait(object, "swpdea");
VM_OBJECT_UNLOCK(object);
/*
* Free all remaining metadata. We only bother to free it from

View File

@ -600,12 +600,12 @@ vm_object_terminate(vm_object_t object)
}
vm_page_unlock_queues();
splx(s);
VM_OBJECT_UNLOCK(object);
/*
* Let the pager know object is dead.
*/
vm_pager_deallocate(object);
VM_OBJECT_UNLOCK(object);
/*
* Remove the object from the global object list.

View File

@ -256,10 +256,15 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size,
return (ret);
}
/*
* The object must be locked.
*/
void
vm_pager_deallocate(object)
vm_object_t object;
{
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
(*pagertab[object->type]->pgo_dealloc) (object);
}

View File

@ -175,19 +175,20 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
return (object);
}
/*
* The object must be locked.
*/
static void
vnode_pager_dealloc(object)
vm_object_t object;
{
struct vnode *vp = object->handle;
GIANT_REQUIRED;
if (vp == NULL)
panic("vnode_pager_dealloc: pager already dealloced");
VM_OBJECT_LOCK(object);
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
vm_object_pip_wait(object, "vnpdea");
VM_OBJECT_UNLOCK(object);
object->handle = NULL;
object->type = OBJT_DEAD;