From c2d93a1c2764c35ccffa8a1adff067a9e8bb6202 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 28 Aug 2007 14:40:57 -0700 Subject: [PATCH] Do not use f_mapping in simple_prepare_write() Seems that simple_preprate_write() may be called for a page that does not have a mapping yet. Retrieve the page size from the page instead of the mapping. Signed-off-by: Christoph Lameter --- fs/libfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux-2.6/fs/libfs.c =================================================================== --- linux-2.6.orig/fs/libfs.c 2007-09-05 01:22:02.000000000 -0700 +++ linux-2.6/fs/libfs.c 2007-09-05 01:52:34.000000000 -0700 @@ -341,10 +341,10 @@ int simple_prepare_write(struct file *fi unsigned from, unsigned to) { if (!PageUptodate(page)) { - if (to - from != page_cache_size(file->f_mapping)) + if (to - from != page_cache_page_size(page)) zero_user_segments(page, 0, from, - to, page_cache_size(file->f_mapping)); + to, page_cache_page_size(page)); } return 0; }