diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-12-12 11:12:30 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-12-14 15:38:36 +0100 |
commit | 8d64d365aed355b2e2465d19ba61df02462fff4d (patch) | |
tree | 7b3924ab7ba6f9d0a71f8085443c62b7f57e1ce2 /fs/f2fs/node.c | |
parent | f2fs: clear PG_writeback if IPU failed (diff) | |
download | linux-8d64d365aed355b2e2465d19ba61df02462fff4d.tar.xz linux-8d64d365aed355b2e2465d19ba61df02462fff4d.zip |
f2fs: fix to reorder set_page_dirty and wait_on_page_writeback
This patch reorders flow from
- update page
- set_page_dirty
- wait_on_page_writeback
to
- wait_on_page_writeback
- update page
- set_page_dirty
The reason is:
- set_page_dirty will increase reference of dirty page, the reference
should be cleared before wait_on_page_writeback to keep its consistency.
- some devices need stable page during page writebacking, so we
should not change page's data.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index a2273340991f..c09df777f66f 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1598,10 +1598,11 @@ int f2fs_move_node_page(struct page *node_page, int gc_type) .for_reclaim = 0, }; - set_page_dirty(node_page); f2fs_wait_on_page_writeback(node_page, NODE, true); - f2fs_bug_on(F2FS_P_SB(node_page), PageWriteback(node_page)); + + set_page_dirty(node_page); + if (!clear_page_dirty_for_io(node_page)) { err = -EAGAIN; goto out_page; |