aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-05-06 17:49:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:51 -0400
commit6fe6900e1e5b6fa9e5c59aa5061f244fe3f467e2 (patch)
tree8bbfe5072279227cc50a941ad4813908082426a1 /fs/ecryptfs
parent714b8171af9c930a59a0da8f6fe50518e70ab035 (diff)
mm: make read_cache_page synchronous
Ensure pages are uptodate after returning from read_cache_page, which allows us to cut out most of the filesystem-internal PageUptodate calls. I didn't have a great look down the call chains, but this appears to fixes 7 possible use-before uptodate in hfs, 2 in hfsplus, 1 in jfs, a few in ecryptfs, 1 in jffs2, and a possible cleared data overwritten with readpage in block2mtd. All depending on whether the filler is async and/or can return with a !uptodate page. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/mmap.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index b731b09499cb..0770c4b66f53 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -46,7 +46,6 @@ struct kmem_cache *ecryptfs_lower_page_cache;
46 */ 46 */
47static struct page *ecryptfs_get1page(struct file *file, int index) 47static struct page *ecryptfs_get1page(struct file *file, int index)
48{ 48{
49 struct page *page;
50 struct dentry *dentry; 49 struct dentry *dentry;
51 struct inode *inode; 50 struct inode *inode;
52 struct address_space *mapping; 51 struct address_space *mapping;
@@ -54,14 +53,7 @@ static struct page *ecryptfs_get1page(struct file *file, int index)
54 dentry = file->f_path.dentry; 53 dentry = file->f_path.dentry;
55 inode = dentry->d_inode; 54 inode = dentry->d_inode;
56 mapping = inode->i_mapping; 55 mapping = inode->i_mapping;
57 page = read_cache_page(mapping, index, 56 return read_mapping_page(mapping, index, (void *)file);
58 (filler_t *)mapping->a_ops->readpage,
59 (void *)file);
60 if (IS_ERR(page))
61 goto out;
62 wait_on_page_locked(page);
63out:
64 return page;
65} 57}
66 58
67static 59static
@@ -233,7 +225,6 @@ int ecryptfs_do_readpage(struct file *file, struct page *page,
233 ecryptfs_printk(KERN_ERR, "Error reading from page cache\n"); 225 ecryptfs_printk(KERN_ERR, "Error reading from page cache\n");
234 goto out; 226 goto out;
235 } 227 }
236 wait_on_page_locked(lower_page);
237 page_data = kmap_atomic(page, KM_USER0); 228 page_data = kmap_atomic(page, KM_USER0);
238 lower_page_data = kmap_atomic(lower_page, KM_USER1); 229 lower_page_data = kmap_atomic(lower_page, KM_USER1);
239 memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE); 230 memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE);