* Re: [patch 1/8] fix race in clear_page_dirty_for_io() [not found] ` <20070307082337.101759335@szeredi.hu> @ 2007-03-07 10:15 ` Andrew Morton 2007-03-07 10:31 ` Miklos Szeredi 0 siblings, 1 reply; 2+ messages in thread From: Andrew Morton @ 2007-03-07 10:15 UTC (permalink / raw) To: Miklos Szeredi; +Cc: linux-kernel, linux-mm, Nick Piggin, Linus Torvalds (cc's reinstated) On Wed, 07 Mar 2007 09:09:50 +0100 Miklos Szeredi <miklos@szeredi.hu> wrote: > There's a race in clear_page_dirty_for_io() that allows a page to have > cleared PG_dirty, while being mapped read-write into the page table(s). I assume you refer to this: * FIXME! We still have a race here: if somebody * adds the page back to the page tables in * between the "page_mkclean()" and the "TestClearPageDirty()", * we might have it mapped without the dirty bit set. */ if (page_mkclean(page)) set_page_dirty(page); if (TestClearPageDirty(page)) { dec_zone_page_state(page, NR_FILE_DIRTY); return 1; } I guess the comment actually refers to a writefault after the set_page_dirty() and before the TestClearPageDirty(). The fault handler will run set_page_dirty() and will return to userspace to rerun the write. The page then gets set pte-dirty but this thread of control will now make the page !PageDirty() and will write it out. With Nick's proposed lock-the-page-in-pagefaults patches, we have lock_page() synchronisation between pagefaults and clear_page_dirty_for_io() which I think will fix this. -- 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:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch 1/8] fix race in clear_page_dirty_for_io() 2007-03-07 10:15 ` [patch 1/8] fix race in clear_page_dirty_for_io() Andrew Morton @ 2007-03-07 10:31 ` Miklos Szeredi 0 siblings, 0 replies; 2+ messages in thread From: Miklos Szeredi @ 2007-03-07 10:31 UTC (permalink / raw) To: akpm; +Cc: linux-kernel, linux-mm, nickpiggin, torvalds > (cc's reinstated) > > On Wed, 07 Mar 2007 09:09:50 +0100 Miklos Szeredi <miklos@szeredi.hu> wrote: > > > There's a race in clear_page_dirty_for_io() that allows a page to have > > cleared PG_dirty, while being mapped read-write into the page table(s). > > I assume you refer to this: > > * FIXME! We still have a race here: if somebody > * adds the page back to the page tables in > * between the "page_mkclean()" and the "TestClearPageDirty()", > * we might have it mapped without the dirty bit set. > */ > if (page_mkclean(page)) > set_page_dirty(page); > if (TestClearPageDirty(page)) { > dec_zone_page_state(page, NR_FILE_DIRTY); > return 1; > } > Yes. > I guess the comment actually refers to a writefault after the > set_page_dirty() and before the TestClearPageDirty(). The fault handler > will run set_page_dirty() and will return to userspace to rerun the write. > The page then gets set pte-dirty but this thread of control will now make > the page !PageDirty() and will write it out. Yes. > With Nick's proposed lock-the-page-in-pagefaults patches, we have > lock_page() synchronisation between pagefaults and > clear_page_dirty_for_io() which I think will fix this. After a quick look, I don't think it does. It locks the page in do_no_page(), but not for the whole fault. In particular do_wp_page() is not affected. But I haven't yet looked closely at that patch, so I could be wrong. Miklos -- 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:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-07 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20070307080949.290171170@szeredi.hu>
[not found] ` <20070307082337.101759335@szeredi.hu>
2007-03-07 10:15 ` [patch 1/8] fix race in clear_page_dirty_for_io() Andrew Morton
2007-03-07 10:31 ` Miklos Szeredi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox