From: Dave Kleikamp <shaggy@austin.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Andrea Arcangeli <andrea@novell.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org
Subject: [PATCH] zap_pte_range should not mark non-uptodate pages dirty
Date: Thu, 21 Oct 2004 16:15:46 -0500 [thread overview]
Message-ID: <1098393346.7157.112.camel@localhost> (raw)
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>
next reply other threads:[~2004-10-21 21:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-21 21:15 Dave Kleikamp [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1098393346.7157.112.camel@localhost \
--to=shaggy@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=andrea@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox