This patch add two bug on check back during flush nat entries, nat_tree_lock will prevent race from node block allocation in write_begin.
Signed-off-by: Yunlei He <heyun...@huawei.com> --- fs/f2fs/node.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 833b46b..ced986d 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2519,10 +2519,9 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi, } /* Allow dirty nats by node block allocation in write_begin */ - if (!set->entry_cnt) { - radix_tree_delete(&NM_I(sbi)->nat_set_root, set->set); - kmem_cache_free(nat_entry_set_slab, set); - } + f2fs_bug_on(sbi, set->entry_cnt); + radix_tree_delete(&NM_I(sbi)->nat_set_root, set->set); + kmem_cache_free(nat_entry_set_slab, set); } /* @@ -2566,8 +2565,8 @@ void flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc) list_for_each_entry_safe(set, tmp, &sets, set_list) __flush_nat_entry_set(sbi, set, cpc); + f2fs_bug_on(sbi, nm_i->dirty_nat_cnt); up_write(&nm_i->nat_tree_lock); - /* Allow dirty nats by node block allocation in write_begin */ } static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) -- 1.9.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel