]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ntfs/compress.c
V4L/DVB (8499): zr36067: Rework device memory allocation
[linux-2.6-omap-h63xx.git] / fs / ntfs / compress.c
index d98daf59e0b64ac91bf3c950594ba6685e6ca737..33ff314cc5073cf9f88a3623db7129fd4ad4e772 100644 (file)
@@ -561,6 +561,16 @@ int ntfs_read_compressed_block(struct page *page)
        read_unlock_irqrestore(&ni->size_lock, flags);
        max_page = ((i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) -
                        offset;
+       /* Is the page fully outside i_size? (truncate in progress) */
+       if (xpage >= max_page) {
+               kfree(bhs);
+               kfree(pages);
+               zero_user(page, 0, PAGE_CACHE_SIZE);
+               ntfs_debug("Compressed read outside i_size - truncated?");
+               SetPageUptodate(page);
+               unlock_page(page);
+               return 0;
+       }
        if (nr_pages < max_page)
                max_page = nr_pages;
        for (i = 0; i < max_page; i++, offset++) {