f2fs: validate before set/clear free nat bitmap
authorLiFan <fanofcode.li@samsung.com>
Fri, 10 Nov 2017 07:41:42 +0000 (15:41 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 19 Dec 2017 03:39:12 +0000 (19:39 -0800)
commita7c6829c1c380908c26e1059b45d425626dec34a
tree28cf2bd668cf793e8f467bc04eb86982d0c83729
parenteb84a567f686f1da5e669a3000f725b66a40ce21
f2fs: validate before set/clear free nat bitmap

In flush_nat_entries, all dirty nats will be flushed and if
their new address isn't NULL_ADDR, their bitmaps will be updated,
the free_nid_count of the bitmaps will be increaced regardless
of whether the nats have already been occupied before.
This could lead to wrong free_nid_count.
So this patch checks the status of the bits beforeactually
set/clear them.

Fixes: 586d1492f301 ("f2fs: skip scanning free nid bitmap of full NAT blocks")
Signed-off-by: Fan li <fanofcode.li@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c