[PATCH 0/3] ovl: Enable support for casefold filesystems

From: André Almeida
Date: Wed Apr 09 2025 - 11:14:07 EST


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