Commit 65a15109 authored by David Howells's avatar David Howells

afs: ->writepage() shouldn't call clear_page_dirty_for_io()

The ->writepage() op shouldn't call clear_page_dirty_for_io() as that has
already been called by the caller.

Fix afs_writepage() by moving the call out of
afs_write_back_from_locked_page() to afs_writepages_region() where it is
needed.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 954cd6dc
...@@ -231,7 +231,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, ...@@ -231,7 +231,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
if (wb->state == AFS_WBACK_PENDING) if (wb->state == AFS_WBACK_PENDING)
wb->state = AFS_WBACK_CONFLICTING; wb->state = AFS_WBACK_CONFLICTING;
spin_unlock(&vnode->writeback_lock); spin_unlock(&vnode->writeback_lock);
if (PageDirty(page)) { if (clear_page_dirty_for_io(page)) {
ret = afs_write_back_from_locked_page(wb, page); ret = afs_write_back_from_locked_page(wb, page);
if (ret < 0) { if (ret < 0) {
afs_put_writeback(candidate); afs_put_writeback(candidate);
...@@ -353,8 +353,6 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb, ...@@ -353,8 +353,6 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb,
_enter(",%lx", primary_page->index); _enter(",%lx", primary_page->index);
count = 1; count = 1;
if (!clear_page_dirty_for_io(primary_page))
BUG();
if (test_set_page_writeback(primary_page)) if (test_set_page_writeback(primary_page))
BUG(); BUG();
...@@ -542,6 +540,8 @@ static int afs_writepages_region(struct address_space *mapping, ...@@ -542,6 +540,8 @@ static int afs_writepages_region(struct address_space *mapping,
wb->state = AFS_WBACK_WRITING; wb->state = AFS_WBACK_WRITING;
spin_unlock(&wb->vnode->writeback_lock); spin_unlock(&wb->vnode->writeback_lock);
if (!clear_page_dirty_for_io(page))
BUG();
ret = afs_write_back_from_locked_page(wb, page); ret = afs_write_back_from_locked_page(wb, page);
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment