fsck: clear unexpected casefold flags

Inodes aren't allowed to have the casefold flag set when they aren't
directories, or if the filesystem superblock doesn't have the casefold
feature enabled.  Clear any such unexpected casefold flags.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Eric Biggers 2020-10-08 21:07:45 -07:00 committed by Jaegeuk Kim
parent 1a7415a9e2
commit 8fd836f25f

View File

@ -790,6 +790,17 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
}
ofs = get_extra_isize(node_blk);
if ((node_blk->i.i_flags & cpu_to_le32(F2FS_CASEFOLD_FL)) &&
(ftype != F2FS_FT_DIR ||
!(c.feature & cpu_to_le32(F2FS_FEATURE_CASEFOLD)))) {
ASSERT_MSG("[0x%x] unexpected casefold flag", nid);
if (c.fix_on) {
FIX_MSG("ino[0x%x] clear casefold flag", nid);
node_blk->i.i_flags &= ~cpu_to_le32(F2FS_CASEFOLD_FL);
need_fix = 1;
}
}
if ((node_blk->i.i_inline & F2FS_INLINE_DATA)) {
unsigned int inline_size = MAX_INLINE_DATA(node_blk);
if (cur_qtype != -1)