Skip to content

Commit dc5a941

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to wait all node page writeback
There is a race condition that we may miss to wait for all node pages writeback, fix it. - fsync() - shrink - f2fs_do_sync_file - __write_node_page - set_page_writeback(page#0) : remove DIRTY/TOWRITE flag - f2fs_fsync_node_pages : won't find page #0 as TOWRITE flag was removeD - f2fs_wait_on_node_pages_writeback : wont' wait page #0 writeback as it was not in fsync_node_list list. - f2fs_add_fsync_node_entry Fixes: 50fa53e ("f2fs: fix to avoid broken of dnode block list") Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent b19e8c6 commit dc5a941

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎fs/f2fs/node.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,15 +1562,16 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,
15621562
if (atomic && !test_opt(sbi, NOBARRIER))
15631563
fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
15641564

1565-
set_page_writeback(page);
1566-
ClearPageError(page);
1567-
1565+
/* should add to global list before clearing PAGECACHE status */
15681566
if (f2fs_in_warm_node_list(sbi, page)) {
15691567
seq = f2fs_add_fsync_node_entry(sbi, page);
15701568
if (seq_id)
15711569
*seq_id = seq;
15721570
}
15731571

1572+
set_page_writeback(page);
1573+
ClearPageError(page);
1574+
15741575
fio.old_blkaddr = ni.blk_addr;
15751576
f2fs_do_write_node_page(nid, &fio);
15761577
set_node_addr(sbi, &ni, fio.new_blkaddr, is_fsync_dnode(page));

0 commit comments

Comments
 (0)