diff options
author | Yunlei He <heyunlei@huawei.com> | 2016-11-16 17:26:24 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@google.com> | 2017-09-25 15:36:55 -0700 |
commit | beaab6afb4c86fd7daa47577220d597cdc183a46 (patch) | |
tree | 18140f040860cf4f1d08f32fb0a900a6e05a040b /fs | |
parent | 9e266223b33dac867e29e7d0393e363ff86e092a (diff) |
f2fs: fix an infinite loop when flush nodes in cp
commit d40a43af0a57a017eba9ad2679183791587ceb6a upstream.
Thread A Thread B
- write_checkpoint
- block_operations
-blk_start_plug
-sync_node_pages - f2fs_do_sync_file
- fsync_node_pages
- f2fs_wait_on_page_writeback
Thread A wait for global F2FS_DIRTY_NODES decreased to zero,
it start a plug list, some requests have been added to this list.
Thread B lock one dirty node page, and wait this page write back.
But this page has been in plug list of thread A with PG_writeback flag.
Thread A keep on running and its plug list has no chance to finish,
so it seems a deadlock between cp and fsync path.
This patch add a wait on page write back before set node page dirty
to avoid this problem.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Pengyang Hou <houpengyang@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/node.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 389be7f6e07c..59cc29e6b73c 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1409,6 +1409,7 @@ continue_unlock: "Retry to write fsync mark: ino=%u, idx=%lx", ino, last_page->index); lock_page(last_page); + f2fs_wait_on_page_writeback(last_page, NODE, true); set_page_dirty(last_page); unlock_page(last_page); goto retry; |