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

Commit 8c2bb1b4 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

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 feb1b25b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);
	if (!f2fs_build_free_nids(sbi, true, false))
		goto retry;
	return false;
}

/*