diff options
author | alc <alc@FreeBSD.org> | 2007-09-27 04:21:59 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2007-09-27 04:21:59 +0000 |
commit | 9d3ffe57cefff26c40bcfe86213497c1af9e9be2 (patch) | |
tree | 6b7cecdc04aa30481a7ed30edd9cc6bb042741b9 /sys/vm/vm_object.c | |
parent | a4724ef3b4fc5854e1a7967115e32388061ea307 (diff) | |
download | FreeBSD-src-9d3ffe57cefff26c40bcfe86213497c1af9e9be2.zip FreeBSD-src-9d3ffe57cefff26c40bcfe86213497c1af9e9be2.tar.gz |
Correct an error of omission in the reimplementation of the page
cache: vm_object_page_remove() should convert any cached pages that
fall with the specified range to free pages. Otherwise, there could
be a problem if a file is first truncated and then regrown.
Specifically, some old data from prior to the truncation might reappear.
Generalize vm_page_cache_free() to support the conversion of either a
subset or the entirety of an object's cached pages.
Reported by: tegge
Reviewed by: tegge
Approved by: re (kensmith)
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r-- | sys/vm/vm_object.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index bf380fa..c227516 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -653,7 +653,7 @@ vm_object_terminate(vm_object_t object) vm_page_unlock_queues(); if (__predict_false(object->cache != NULL)) - vm_page_cache_free(object); + vm_page_cache_free(object, 0, 0); /* * Let the pager know object is dead. @@ -1680,7 +1680,7 @@ vm_object_collapse(vm_object_t object) * Free any cached pages from backing_object. */ if (__predict_false(backing_object->cache != NULL)) - vm_page_cache_free(backing_object); + vm_page_cache_free(backing_object, 0, 0); } /* * Object now shadows whatever backing_object did. @@ -1849,6 +1849,8 @@ again: } vm_page_unlock_queues(); vm_object_pip_wakeup(object); + if (__predict_false(object->cache != NULL)) + vm_page_cache_free(object, start, end); } /* |