From: Nick Piggin Date: Mon, 16 Jul 2007 06:38:12 +0000 (-0700) Subject: mm: debug check for the fault vs invalidate race X-Git-Tag: v2.6.23-rc1~1027 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45426812d6b601430d560cb6049757b5b0bc71c4;p=linux-2.6 mm: debug check for the fault vs invalidate race 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/filemap.c b/mm/filemap.c index c6ebd9f912..e006c57bda 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -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)