mm: debug check for the fault vs invalidate race
authorNick Piggin <npiggin@suse.de>
Mon, 16 Jul 2007 06:38:12 +0000 (23:38 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:35 +0000 (09:05 -0700)
Add a bugcheck for Andrea's pagefault vs invalidate race.  This is triggerable
for both linear and nonlinear pages with a userspace test harness (using
direct IO and truncate, respectively).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c

index c6ebd9f..e006c57 100644 (file)
@@ -120,6 +120,7 @@ void __remove_from_page_cache(struct page *page)
        page->mapping = NULL;
        mapping->nrpages--;
        __dec_zone_page_state(page, NR_FILE_PAGES);
+       BUG_ON(page_mapped(page));
 }
 
 void remove_from_page_cache(struct page *page)