squashfs: fix read regression introduced in readahead code
[linux-2.6-block.git] / fs / squashfs / page_actor.c
index 54b93bf4a25c15b9acb2bf85cbcab6723df89e40..81af6c4ca115784c3f93a04fbbb439a2e3191844 100644 (file)
@@ -71,11 +71,13 @@ static void *handle_next_page(struct squashfs_page_actor *actor)
                        (actor->next_index != actor->page[actor->next_page]->index)) {
                actor->next_index++;
                actor->returned_pages++;
+               actor->last_page = NULL;
                return actor->alloc_buffer ? actor->tmp_buffer : ERR_PTR(-ENOMEM);
        }
 
        actor->next_index++;
        actor->returned_pages++;
+       actor->last_page = actor->page[actor->next_page];
        return actor->pageaddr = kmap_local_page(actor->page[actor->next_page++]);
 }
 
@@ -125,6 +127,7 @@ struct squashfs_page_actor *squashfs_page_actor_init_special(struct squashfs_sb_
        actor->returned_pages = 0;
        actor->next_index = page[0]->index & ~((1 << (msblk->block_log - PAGE_SHIFT)) - 1);
        actor->pageaddr = NULL;
+       actor->last_page = NULL;
        actor->alloc_buffer = msblk->decompressor->alloc_buffer;
        actor->squashfs_first_page = direct_first_page;
        actor->squashfs_next_page = direct_next_page;