* read_chunk_into_cache() might not have put back physical pages

in case of a read error.

(coded by axeld)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16510 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-02-26 17:41:38 +00:00
parent 60a50e3a73
commit b270799715
1 changed files with 9 additions and 0 deletions

View File

@ -461,7 +461,16 @@ read_chunk_into_cache(file_cache_ref *ref, off_t offset, size_t size,
dprintf("file_cache: read pages failed: %s\n", strerror(status));
for (int32 i = 0; i < vecCount; i++) {
addr_t base = (addr_t)vecs[i].iov_base;
size_t size = vecs[i].iov_len;
for (size_t pos = 0; pos < size; pos += B_PAGE_SIZE, base += B_PAGE_SIZE)
vm_put_physical_page(base);
}
mutex_lock(&cache->lock);
for (int32 i = 0; i < pageIndex; i++) {
vm_cache_remove_page(cache, pages[i]);
vm_page_set_state(pages[i], PAGE_STATE_FREE);