Re: [PATCH v2] f2fs: Introduce linear search for dentries

From: Christoph Hellwig
Date: Mon Dec 23 2024 - 03:26:42 EST


On Fri, Dec 20, 2024 at 09:21:36AM -0800, Daniel Lee wrote:
> 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").

That also breaks all other direct hashed and needs to be fixed.

>
> 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.

That means you have really bad worst case behavior for negative lookups.
I don' think this is in any way a good idea.