From: Hugh Dickins <hugh@veritas.com>

If unmap_mapping_range (and mapping->truncate_count) are doing their jobs
right, truncate_complete_page should never find the page mapped: add BUG_ON
for our immediate testing, but this patch should probably not go to mainline -
a mapped page here is not a catastrophe.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/mm/truncate.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN mm/truncate.c~vmtrunc-bug-if-page_mapped mm/truncate.c
--- 25/mm/truncate.c~vmtrunc-bug-if-page_mapped	2004-10-03 14:25:22.474666216 -0700
+++ 25-akpm/mm/truncate.c	2004-10-03 14:25:22.477665760 -0700
@@ -45,6 +45,7 @@ static inline void truncate_partial_page
 static void
 truncate_complete_page(struct address_space *mapping, struct page *page)
 {
+	BUG_ON(page_mapped(page));
 	if (page->mapping != mapping)
 		return;
 
_