[lkml]   [2005]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] tmpfs caused truncate BUG
Just before removing truncate_complete_page's BUG_ON(page_mapped(page)),
thought I'd recheck on a few filesystems. The shame! Easily triggered
with tmpfs: not because of recent changes, but because shmem_nopage
omitted the i_size_read from Andrea's careful truncate_count/i_size_read
/cachelookup/truncate_count sequence. For varying reasons, other users
of shmem_getpage can't go beyond i_size, so just add it to shmem_nopage.

Signed-off-by: Hugh Dickins <>

--- 2.6.11-rc3/mm/shmem.c 2005-02-03 09:06:16.000000000 +0000
+++ linux/mm/shmem.c 2005-02-05 16:52:57.000000000 +0000
@@ -1162,6 +1162,8 @@ struct page *shmem_nopage(struct vm_area
idx = (address - vma->vm_start) >> PAGE_SHIFT;
idx += vma->vm_pgoff;
+ if (((loff_t) idx << PAGE_CACHE_SHIFT) >= i_size_read(inode))

error = shmem_getpage(inode, idx, &page, SGP_CACHE, type);
if (error)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 14:10    [W:0.019 / U:1.104 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site