]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: check segment type in __f2fs_replace_block
authorYunlong Song <yunlong.song@huawei.com>
Thu, 4 Jan 2018 07:02:02 +0000 (15:02 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 16 Jan 2018 23:39:57 +0000 (15:39 -0800)
commit0d2c4fd1dfee90b3efbc63d35e363f5cb77b2a99
treed0decd9b42d414c7b1cd26c27f3492ed0cd60ac0
parentab28fb6a3e7aee7ddd25b576a14e78116c822905
f2fs: check segment type in __f2fs_replace_block

In some case, the node blocks has wrong blkaddr whose segment type is
NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
the xattr range. Since fsck.f2fs does not check the recovery nodes, this
will cause __f2fs_replace_block change the curseg of node and do the
update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
result, when recovery process write checkpoint and sync nodes, the
next_blkoff of curseg is used in the segment bit map, then it will
cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c