]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ntfs/compress.c
Merge branch 'r8169-next' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu...
[linux-2.6-omap-h63xx.git] / fs / ntfs / compress.c
index 25d24106f893a691cbc7cc5010cf4b181dbdfc8a..33ff314cc5073cf9f88a3623db7129fd4ad4e772 100644 (file)
@@ -67,7 +67,7 @@ static DEFINE_SPINLOCK(ntfs_cb_lock);
 /**
  * allocate_compression_buffers - allocate the decompression buffers
  *
- * Caller has to hold the ntfs_lock semaphore.
+ * Caller has to hold the ntfs_lock mutex.
  *
  * Return 0 on success or -ENOMEM if the allocations failed.
  */
@@ -84,7 +84,7 @@ int allocate_compression_buffers(void)
 /**
  * free_compression_buffers - free the decompression buffers
  *
- * Caller has to hold the ntfs_lock semaphore.
+ * Caller has to hold the ntfs_lock mutex.
  */
 void free_compression_buffers(void)
 {
@@ -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++) {
@@ -600,7 +610,7 @@ do_next_cb:
        rl = NULL;
        for (vcn = start_vcn, start_vcn += cb_clusters; vcn < start_vcn;
                        vcn++) {
-               BOOL is_retry = FALSE;
+               bool is_retry = false;
 
                if (!rl) {
 lock_retry_remap:
@@ -626,7 +636,7 @@ lock_retry_remap:
                                break;
                        if (is_retry || lcn != LCN_RL_NOT_MAPPED)
                                goto rl_err;
-                       is_retry = TRUE;
+                       is_retry = true;
                        /*
                         * Attempt to map runlist, dropping lock for the
                         * duration.