Re: [PATCH 0/3] ovl: Enable support for casefold filesystems
From: Amir Goldstein
Date: Wed Apr 09 2025 - 13:17:50 EST
On Wed, Apr 9, 2025 at 5:01 PM André Almeida <andrealmeid@xxxxxxxxxx> wrote:
>
> Hi all,
>
> We would like to support the usage of casefold filesystems with
> overlayfs. This patchset do some of the work needed for that, but I'm
> sure there are more places that need to be tweaked so please share your
> feedback for this work.
>
> * Implementation
>
> The most obvious place that required change was the strncmp() inside of
> ovl_cache_entry_find(), that I managed to convert to use d_same_name(),
That's a very niche part of overlayfs where comparison of names matter.
Please look very closely at ovl_lookup() and how an overlay entry stack is
composed from several layers including the option to redirect to different names
via redirect xattr, so there is really very much to deal with other
than readdir.
I suggest that you start with a design proposal of how you intend to tackle this
task and what are your requirements?
Any combination of casefold supported layers?
Thanks,
Amir.
> that will then call the generic_ci_d_compare function if it's set for
> the dentry. There are more strncmp() around ovl, but I would rather hear
> feedback about this approach first than already implementing this around
> the code.
>
> * Testing
>
> I used tmpfs to create a small ovl like this:
>
> sudo mount -t tmpfs -o casefold tmpfs mnt/
> cd mnt/
> mkdir dir
> chattr +F dir
> cd dir/
> mkdir upper lower
> mkdir lower/A lower/b lower/c
> mkdir upper/a upper/b upper/d
> mkdir merged work
> sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work, merged
> ls /tmp/mnt/dir/merged/
> a b c d
>
> And ovl is respecting the equivalent names. `a` points to a merged dir
> between `A` and `a`, but giving that upperdir has a lowercase `a`, this
> is the name displayed here.
>
> Thanks,
> André
>
> ---
> André Almeida (3):
> ovl: Make ovl_cache_entry_find support casefold
> ovl: Make ovl_dentry_weird() accept casefold dentries
> ovl: Enable support for casefold filesystems
>
> fs/overlayfs/namei.c | 11 ++++++-----
> fs/overlayfs/overlayfs.h | 2 +-
> fs/overlayfs/ovl_entry.h | 1 +
> fs/overlayfs/params.c | 5 +++--
> fs/overlayfs/readdir.c | 32 +++++++++++++++++++++-----------
> fs/overlayfs/util.c | 12 +++++++-----
> 6 files changed, 39 insertions(+), 24 deletions(-)
> ---
> base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
> change-id: 20250409-tonyk-overlayfs-591f5e4d407a
>
> Best regards,
> --
> André Almeida <andrealmeid@xxxxxxxxxx>
>