All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [f2fs-tools PATCH] fsck: clear unexpected casefold flags
@ 2020-10-09  4:07 Eric Biggers
  2020-10-09  7:33 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2020-10-09  4:07 UTC (permalink / raw)
  To: linux-f2fs-devel, Jaegeuk Kim, Chao Yu

From: Eric Biggers <ebiggers@google.com>

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>
---
 fsck/fsck.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index f97e9fb..6475233 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -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)
-- 
2.28.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [f2fs-tools PATCH] fsck: clear unexpected casefold flags
  2020-10-09  4:07 [f2fs-dev] [f2fs-tools PATCH] fsck: clear unexpected casefold flags Eric Biggers
@ 2020-10-09  7:33 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2020-10-09  7:33 UTC (permalink / raw)
  To: Eric Biggers, linux-f2fs-devel, Jaegeuk Kim, Chao Yu

On 2020/10/9 12:07, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-09  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  4:07 [f2fs-dev] [f2fs-tools PATCH] fsck: clear unexpected casefold flags Eric Biggers
2020-10-09  7:33 ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.