Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c783946e authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Greg Kroah-Hartman
Browse files

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: default avatarChao Yu <chao@kernel.org>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent caab324d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);
	if (!f2fs_build_free_nids(sbi, true, false))
		goto retry;
	return false;
}

/*