Commit f84262b0 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: avoid infinite loop in f2fs_alloc_nid

If we have an error in f2fs_build_free_nids, we're able to fall into a loop
to find free nids.
Suggested-by: default avatarChao Yu <chao@kernel.org>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent a7d10cf3
......@@ -2350,8 +2350,9 @@ bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid)
spin_unlock(&nm_i->nid_list_lock);
/* Let's scan nat pages and its caches to get free nids */
f2fs_build_free_nids(sbi, true, false);
goto retry;
if (!f2fs_build_free_nids(sbi, true, false))
goto retry;
return false;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment