summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@zip.com.au>2002-07-04 08:31:36 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-07-04 08:31:36 -0700
commit2ab9665b73efda989f04aba596e2d26c1c152e4d (patch)
tree76199cccbac0fd485b2096f0e693527a627c6f49 /fs
parent193ae03649cdb7e0f0952314e3fac2c850b3d86a (diff)
[PATCH] fix a writeback race
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.
Diffstat (limited to 'fs')
-rw-r--r--fs/mpage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/mpage.c b/fs/mpage.c
index 5c1cdc5b8c10..3dfe1187e877 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -515,8 +515,8 @@ mpage_writepages(struct address_space *mapping,
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);