提交 c783946e 编写于 作者: J Jaegeuk Kim 提交者: Greg Kroah-Hartman

f2fs: avoid infinite loop in f2fs_alloc_nid

[ Upstream commit f84262b0862d43b71b3e80a036cdd9d82e620367 ]

If we have an error in f2fs_build_free_nids, we're able to fall into a loop
to find free nids.
Suggested-by: NChao Yu <chao@kernel.org>
Reviewed-by: NChao Yu <yuchao0@huawei.com>
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 caab324d
......@@ -2367,8 +2367,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册