linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zap_pte_range should not mark non-uptodate pages dirty
@ 2004-10-21 21:15 Dave Kleikamp
  2004-10-21 21:45 ` Andrew Morton
  0 siblings, 1 reply; 22+ messages in thread
From: Dave Kleikamp @ 2004-10-21 21:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andrea Arcangeli, linux-kernel, linux-mm

zap_pte_range should not mark non-uptodate pages dirty

Doing O_DIRECT writes to an mmapped file caused pages in the page cache to
be marked dirty but not uptodate.  This led to a bug in mpage_writepage.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrea Arcangeli <andrea@novell.com>

diff -urp linux-2.6.9/mm/memory.c linux/mm/memory.c
--- linux-2.6.9/mm/memory.c	2004-10-21 10:49:26.598031488 -0500
+++ linux/mm/memory.c	2004-10-21 16:01:44.902376232 -0500
@@ -414,7 +414,15 @@ static void zap_pte_range(struct mmu_gat
 			    && linear_page_index(details->nonlinear_vma,
 					address+offset) != page->index)
 				set_pte(ptep, pgoff_to_pte(page->index));
-			if (pte_dirty(pte))
+			/*
+			 * PG_uptodate can be cleared by
+			 * invalidate_inode_pages2, so we must not try to write
+			 * not uptodate pages.  Otherwise we risk invalidating
+			 * underlying O_DIRECT writes, and secondly because
+			 * pdflush would BUG().  Coherency of mmaps against
+			 * O_DIRECT still cannot be guaranteed though.
+			 */
+			if (pte_dirty(pte) && PageUptodate(page))
 				set_page_dirty(page);
 			if (pte_young(pte) && !PageAnon(page))
 				mark_page_accessed(page);


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2004-11-09 19:51 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 21:15 [PATCH] zap_pte_range should not mark non-uptodate pages dirty Dave Kleikamp
2004-10-21 21:45 ` Andrew Morton
2004-10-21 22:36   ` Andrea Arcangeli
2004-10-21 23:02     ` Andrew Morton
2004-10-21 23:20       ` Andrea Arcangeli
2004-10-21 23:42         ` Andrew Morton
2004-10-22  0:15           ` Andrew Morton
2004-10-22  0:41             ` Andrea Arcangeli
2004-10-22  2:51               ` Rik van Riel
2004-10-22 16:19                 ` Andrea Arcangeli
2004-10-22  0:30           ` Andrea Arcangeli
2004-10-22  1:22             ` Andrea Arcangeli
2004-10-22  2:03               ` Andrew Morton
2004-10-22 16:17                 ` Andrea Arcangeli
2004-10-22 17:04                   ` Andrea Arcangeli
2004-10-22 23:24                   ` Andrew Morton
2004-10-25 13:58                     ` Dave Kleikamp
2004-10-26  0:35                     ` Andrea Arcangeli
2004-11-09 14:15                     ` Dave Kleikamp
2004-11-09 14:46                       ` Andrea Arcangeli
2004-11-09 19:51                         ` Andrew Morton
2004-11-09 19:46                       ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox