summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2007-02-13 13:14:45 +0100
committerAdrian Bunk <bunk@stusta.de>2007-02-13 13:14:45 +0100
commitb3d6856755b3d0380da5dda54ee273f20ee4a539 (patch)
tree2380e107b1e065a4884284eddfa534ee12c237eb
parent0e894923475e1f59dc7b58851e90c4114acf2e2f (diff)
downloadlwn-b3d6856755b3d0380da5dda54ee273f20ee4a539.tar.gz
lwn-b3d6856755b3d0380da5dda54ee273f20ee4a539.zip
Fix up CIFS for "test_clear_page_dirty()" removal
This also adds he required page "writeback" flag handling, that cifs hasn't been doing and that the page dirty flag changes made obvious. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Acked-by: Steve French <smfltc@us.ibm.com>
-rw-r--r--fs/cifs/file.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 675bd2568297..7108eb47bf5d 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1135,14 +1135,21 @@ retry:
wait_on_page_writeback(page);
if (PageWriteback(page) ||
- !test_clear_page_dirty(page)) {
+ !clear_page_dirty_for_io(page)) {
unlock_page(page);
break;
}
+ /*
+ * This actually clears the dirty bit in the radix tree.
+ * See cifs_writepage() for more commentary.
+ */
+ set_page_writeback(page);
+
if (page_offset(page) >= mapping->host->i_size) {
done = 1;
unlock_page(page);
+ end_page_writeback(page);
break;
}
@@ -1206,6 +1213,7 @@ retry:
SetPageError(page);
kunmap(page);
unlock_page(page);
+ end_page_writeback(page);
page_cache_release(page);
}
if ((wbc->nr_to_write -= n_iov) <= 0)
@@ -1242,11 +1250,23 @@ static int cifs_writepage(struct page* page, struct writeback_control *wbc)
if (!PageUptodate(page)) {
cFYI(1, ("ppw - page not up to date"));
}
-
+
+ /*
+ * Set the "writeback" flag, and clear "dirty" in the radix tree.
+ *
+ * A writepage() implementation always needs to do either this,
+ * or re-dirty the page with "redirty_page_for_writepage()" in
+ * the case of a failure.
+ *
+ * Just unlocking the page will cause the radix tree tag-bits
+ * to fail to update with the state of the page correctly.
+ */
+ set_page_writeback(page);
rc = cifs_partialpagewrite(page, 0, PAGE_CACHE_SIZE);
SetPageUptodate(page); /* BB add check for error and Clearuptodate? */
unlock_page(page);
- page_cache_release(page);
+ end_page_writeback(page);
+ page_cache_release(page);
FreeXid(xid);
return rc;
}