Merge "f2fs: fix indefinite loop scanning for free nid"

This commit is contained in:
qctecmdr 2020-11-02 02:18:44 -08:00 • committed by Gerrit - the friendly Code Review server
commit e350f2d4e0

View file

@ -2371,6 +2371,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi,
if (unlikely(nid >= nm_i->max_nid))
nid = 0;
if (unlikely(nid % NAT_ENTRY_PER_BLOCK))
nid = NAT_BLOCK_OFFSET(nid) * NAT_ENTRY_PER_BLOCK;
/* Enough entries */
if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
return 0;