diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index f07ae58d266d..339239bb7f63 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -343,7 +343,7 @@ static int recover_inode(struct inode *inode, struct page *page) } static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, - bool check_only) + bool check_only, bool *new_inode) { struct curseg_info *curseg; struct page *page = NULL; @@ -400,6 +400,8 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, if (IS_ERR(entry)) { err = PTR_ERR(entry); if (err == -ENOENT) { + if (check_only) + *new_inode = true; err = 0; goto next; } @@ -805,6 +807,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) unsigned long s_flags = sbi->sb->s_flags; bool need_writecp = false; bool fix_curseg_write_pointer = false; + bool new_inode = false; #ifdef CONFIG_QUOTA int quota_enabled; #endif @@ -829,8 +832,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) down_write(&sbi->cp_global_sem); /* step #1: find fsynced inode numbers */ - err = find_fsync_dnodes(sbi, &inode_list, check_only); - if (err || list_empty(&inode_list)) + err = find_fsync_dnodes(sbi, &inode_list, check_only, &new_inode); + if (err < 0 || (list_empty(&inode_list) && (!check_only || !new_inode))) goto skip; if (check_only) {