From d2d7b8a2a756fb520792ca3db3abdeed9214ae5b Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Tue, 2 May 2006 12:09:42 -0400 Subject: [PATCH] [GFS2] Fix bug in writepage() As pointed out by Wendy Cheng, the logic in GFS2's writepage() function wasn't quite right with respect to invalidating pages when a file has been truncated. This patch fixes that. CC: Wendy Cheng Signed-off-by: Steven Whitehouse --- fs/gfs2/ops_address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 005c2522a879..afcc12a00a3c 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c @@ -126,7 +126,7 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc) /* Is the page fully outside i_size? (truncate in progress) */ offset = i_size & (PAGE_CACHE_SIZE-1); - if (page->index >= end_index+1 || !offset) { + if (page->index > end_index || (page->index == end_index && !offset)) { page->mapping->a_ops->invalidatepage(page, 0); unlock_page(page); return 0; /* don't care */ -- 2.39.5