diff options
author | kib <kib@FreeBSD.org> | 2010-11-18 21:09:02 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-11-18 21:09:02 +0000 |
commit | 3851a62f83f8895f2a038788c53959a7359f30f4 (patch) | |
tree | 94645bc70e8cb4804519c9b76e5bf90ba7a76b30 /sys/vm/vm_object.c | |
parent | 38737a3b4655a7e5f2b497236c0e9c6561896b31 (diff) | |
download | FreeBSD-src-3851a62f83f8895f2a038788c53959a7359f30f4.zip FreeBSD-src-3851a62f83f8895f2a038788c53959a7359f30f4.tar.gz |
vm_pageout_flush() might cache the pages that finished write to the
backing storage. Such pages might be then reused, racing with the
assert in vm_object_page_collect_flush() that verified that dirty
pages from the run (most likely, pages with VM_PAGER_AGAIN status) are
write-protected still. In fact, the page indexes for the pages that
were removed from the object page list should be ignored by
vm_object_page_clean().
Return the length of successfully written run from vm_pageout_flush(),
that is, the count of pages between requested page and first page
after requested with status VM_PAGER_AGAIN. Supply the requested page
index in the array to vm_pageout_flush(). Use the returned run length
to forward the index of next page to clean in vm_object_page_clean().
Reported by: avg
Reviewed by: alc
MFC after: 1 week
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r-- | sys/vm/vm_object.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index cbc9a906..6664060 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -884,30 +884,9 @@ vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags) index = (maxb + i) + 1; ma[index] = maf[i]; } - runlen = maxb + maxf + 1; - - vm_pageout_flush(ma, runlen, pagerflags); - for (i = 0; i < runlen; i++) { - if (ma[i]->dirty != 0) { - KASSERT((ma[i]->flags & PG_WRITEABLE) == 0, - ("vm_object_page_collect_flush: page %p is not write protected", - ma[i])); - } - } - for (i = 0; i < maxf; i++) { - if (ma[i + maxb + 1]->dirty != 0) { - /* - * maxf will end up being the actual number of pages - * we wrote out contiguously, non-inclusive of the - * first page. We do not count look-behind pages. - */ - if (maxf > i) { - maxf = i; - break; - } - } - } - return (maxf + 1); + + vm_pageout_flush(ma, maxb + maxf + 1, pagerflags, maxb + 1, &runlen); + return (runlen); } /* |