f2fs: Introduce linear search for dentries
authorDaniel Lee <chullee@google.com>
Fri, 20 Dec 2024 23:41:31 +0000 (15:41 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 8 Jan 2025 18:31:45 +0000 (18:31 +0000)
commit91b587ba79e1b68bb718d12b0758dbcdab4e9cb7
tree35ca197d567c54d26370ff37475ed1852c09b2c5
parentd217b5cea488c0f644c189f91b636aeefa12deb9
f2fs: Introduce linear search for dentries

This patch addresses an issue where some files in case-insensitive
directories become inaccessible due to changes in how the kernel function,
utf8_casefold(), generates case-folded strings from the commit 5c26d2f1d3f5
("unicode: Don't special case ignorable code points").

F2FS uses these case-folded names to calculate hash values for locating
dentries and stores them on disk. Since utf8_casefold() can produce
different output across kernel versions, stored hash values and newly
calculated hash values may differ. This results in affected files no
longer being found via the hash-based lookup.

To resolve this, the patch introduces a linear search fallback.
If the initial hash-based search fails, F2FS will sequentially scan the
directory entries.

Fixes: 5c26d2f1d3f5 ("unicode: Don't special case ignorable code points")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219586
Signed-off-by: Daniel Lee <chullee@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/inline.c