Skip to contentSkip to conversation

fsck: clear unexpected casefold flags

PATCH In review Eric Biggers 2 participants 2 messages Oct 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck: clear unexpected casefold flags

From: Eric Biggers <[email protected]>

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.

---
 fsck/fsck.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
fsck/fsck.c +11 -0
index f97e9fb..6475233 100644
@@ -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)
Signature · 8 lines
2.28.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Eric Biggers

From: Eric Biggers <[email protected]>

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.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel