From: Andrew Morton <[email-masked]>

Cc: Eric Sandeen <sandeen.sgi.com>
Signed-off-by: Andrew Morton <[email-masked]>
---

 fs/buffer.c   |    1 +
 mm/truncate.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff -puN fs/buffer.c~clear_buffer_uptodate-in-discard_buffer-check fs/buffer.c
--- devel/fs/buffer.c~clear_buffer_uptodate-in-discard_buffer-check	2005-09-14 20:55:15.000000000 -0700
+++ devel-akpm/fs/buffer.c	2005-09-14 20:55:15.000000000 -0700
@@ -1550,6 +1550,7 @@ static inline void discard_buffer(struct
 	clear_buffer_dirty(bh);
 	bh->b_bdev = NULL;
 	clear_buffer_uptodate(bh);
+	WARN_ON(bh->b_page && PageUptodate(bh->b_page));
 	clear_buffer_mapped(bh);
 	clear_buffer_req(bh);
 	clear_buffer_new(bh);
diff -puN mm/truncate.c~clear_buffer_uptodate-in-discard_buffer-check mm/truncate.c
--- devel/mm/truncate.c~clear_buffer_uptodate-in-discard_buffer-check	2005-09-14 20:55:15.000000000 -0700
+++ devel-akpm/mm/truncate.c	2005-09-14 20:55:15.000000000 -0700
@@ -39,11 +39,11 @@ truncate_complete_page(struct address_sp
 	if (page->mapping != mapping)
 		return;
 
+	ClearPageUptodate(page);
 	if (PagePrivate(page))
 		do_invalidatepage(page, 0);
 
 	clear_page_dirty(page);
-	ClearPageUptodate(page);
 	ClearPageMappedToDisk(page);
 	remove_from_page_cache(page);
 	page_cache_release(page);	/* pagecache ref */
_