Assert that the containing vm object is locked in vm_page_cache() and

vm_page_try_to_cache().
This commit is contained in:
Alan Cox 2004-10-28 05:26:21 +00:00
parent 4ebbd9b988
commit f4d49654ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137005

View File

@ -1266,6 +1266,7 @@ vm_page_try_to_cache(vm_page_t m)
{ {
mtx_assert(&vm_page_queue_mtx, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED);
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
if (m->dirty || m->hold_count || m->busy || m->wire_count || if (m->dirty || m->hold_count || m->busy || m->wire_count ||
(m->flags & (PG_BUSY|PG_UNMANAGED))) { (m->flags & (PG_BUSY|PG_UNMANAGED))) {
return (0); return (0);
@ -1314,6 +1315,7 @@ vm_page_cache(vm_page_t m)
{ {
mtx_assert(&vm_page_queue_mtx, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED);
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
if ((m->flags & (PG_BUSY|PG_UNMANAGED)) || m->busy || if ((m->flags & (PG_BUSY|PG_UNMANAGED)) || m->busy ||
m->hold_count || m->wire_count) { m->hold_count || m->wire_count) {
printf("vm_page_cache: attempting to cache busy page\n"); printf("vm_page_cache: attempting to cache busy page\n");