Add couple more assertions to vm_pager_assert_in(). The bogus page is

not allowed at ends of the request, and all non-bogus pages must be
consecutive.

Reviewed by:	kib
This commit is contained in:
Gleb Smirnoff 2019-10-25 16:59:54 +00:00
parent 174bd5b040
commit 42a621624d

View File

@ -257,15 +257,20 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, int count)
{ {
#ifdef INVARIANTS #ifdef INVARIANTS
/*
* All pages must be consecutive, busied, not mapped, not fully valid,
* not dirty and belong to the proper object. Some pages may be the
* bogus page, but the first and last pages must be a real ones.
*/
VM_OBJECT_ASSERT_WLOCKED(object); VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT(count > 0, ("%s: 0 count", __func__)); KASSERT(count > 0, ("%s: 0 count", __func__));
/*
* All pages must be busied, not mapped, not fully valid,
* not dirty and belong to the proper object.
*/
for (int i = 0 ; i < count; i++) { for (int i = 0 ; i < count; i++) {
if (m[i] == bogus_page) if (m[i] == bogus_page) {
KASSERT(i != 0 && i != count - 1,
("%s: page %d is the bogus page", __func__, i));
continue; continue;
}
vm_page_assert_xbusied(m[i]); vm_page_assert_xbusied(m[i]);
KASSERT(!pmap_page_is_mapped(m[i]), KASSERT(!pmap_page_is_mapped(m[i]),
("%s: page %p is mapped", __func__, m[i])); ("%s: page %p is mapped", __func__, m[i]));
@ -275,6 +280,8 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, int count)
("%s: page %p is dirty", __func__, m[i])); ("%s: page %p is dirty", __func__, m[i]));
KASSERT(m[i]->object == object, KASSERT(m[i]->object == object,
("%s: wrong object %p/%p", __func__, object, m[i]->object)); ("%s: wrong object %p/%p", __func__, object, m[i]->object));
KASSERT(m[i]->pindex == m[0]->pindex + i,
("%s: page %p isn't consecutive", __func__, m[i]));
} }
#endif #endif
} }