* [patch 20/27] fix a writeback race
@ 2002-07-04 23:54 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2002-07-04 23:54 UTC (permalink / raw)
To: Linus Torvalds; +Cc: lkml
Fixes a bug in generic_writepages() and its cut-n-paste-cousin,
mpage_writepages().
The code was clearing PageDirty and then baling out if it discovered
the page was nder writeback. Which would cause the dirty bit to be
lost.
It's a very small window, but reversing the order so PageDirty is only
cleared when we know for-sure that IO will be started fixes it up.
fs/mpage.c | 4 ++--
mm/page-writeback.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
--- 2.5.24/fs/mpage.c~writeback-dirty-fix Thu Jul 4 16:17:30 2002
+++ 2.5.24-akpm/fs/mpage.c Thu Jul 4 16:22:05 2002
@@ -515,8 +515,8 @@ mpage_writepages(struct address_space *m
lock_page(page);
- if (page->mapping && TestClearPageDirty(page) &&
- !PageWriteback(page)) {
+ if (page->mapping && !PageWriteback(page) &&
+ TestClearPageDirty(page)) {
/* FIXME: batch this up */
if (!PageActive(page) && PageLRU(page)) {
spin_lock(&pagemap_lru_lock);
--- 2.5.24/mm/page-writeback.c~writeback-dirty-fix Thu Jul 4 16:17:30 2002
+++ 2.5.24-akpm/mm/page-writeback.c Thu Jul 4 16:22:05 2002
@@ -383,8 +383,8 @@ int generic_writepages(struct address_sp
lock_page(page);
/* It may have been removed from swapcache: check ->mapping */
- if (page->mapping && TestClearPageDirty(page) &&
- !PageWriteback(page)) {
+ if (page->mapping && !PageWriteback(page) &&
+ TestClearPageDirty(page)) {
/* FIXME: batch this up */
if (!PageActive(page) && PageLRU(page)) {
spin_lock(&pagemap_lru_lock);
-
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-07-04 23:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-04 23:54 [patch 20/27] fix a writeback race Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox