* [PATCH] ovl: restrict casefold consistency checks to directories
@ 2026-10-28 15:40 Hungyu Lin
2026-10-29 11:03 ` Amir Goldstein
2026-10-30 18:49 ` André Almeida
0 siblings, 2 replies; 5+ messages in thread
From: Hungyu Lin @ 2026-10-28 15:40 UTC (permalink / raw)
To: miklos
Cc: amir73il, andrealmeid, linux-unionfs, linux-fsdevel,
linux-kernel, stable, dennylin0707
ovl_lookup_single() compares every positive child's casefold flag with
that of the overlay. On casefolded ext4, regular files do not inherit
the casefold flag from their parent directory. Looking up an existing
regular file on a casefolded overlay therefore fails with EREMOTE.
Symlinks, FIFOs and whiteouts are rejected by the same check.
Restrict the child consistency check to directories, along with the
corresponding assertion in ovl_get_inode(). This allows nondirectory
objects to be looked up without rejecting them or warning about their
flags, while directories with inconsistent casefold settings are still
rejected.
Fixes: 16754d61dc69 ("ovl: Support mounting case-insensitive enabled layers")
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
fs/overlayfs/inode.c | 2 +-
fs/overlayfs/namei.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 63906b3dafcb..4428c50c3185 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -1278,7 +1278,7 @@ struct inode *ovl_get_inode(struct super_block *sb,
}
ovl_fill_inode(inode, realinode->i_mode, realinode->i_rdev);
ovl_inode_init(inode, oip, ino, fsid);
- WARN_ON_ONCE(!!IS_CASEFOLDED(inode) != ofs->casefold);
+ WARN_ON_ONCE(is_dir && !!IS_CASEFOLDED(inode) != ofs->casefold);
if (upperdentry && ovl_is_impuredir(sb, upperdentry))
ovl_set_flag(OVL_IMPURE, inode);
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index ca899fdfaafd..023966d89f74 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -266,7 +266,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
goto out_err;
}
- if (ofs->casefold != ovl_dentry_casefolded(this)) {
+ if (d_is_dir(this) && ofs->casefold != ovl_dentry_casefolded(this)) {
warn = "child wrong casefold";
err = -EREMOTE;
goto out_warn;
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: restrict casefold consistency checks to directories
2026-10-28 15:40 [PATCH] ovl: restrict casefold consistency checks to directories Hungyu Lin
@ 2026-10-29 11:03 ` Amir Goldstein
2026-10-29 16:44 ` Hungyu Lin
2026-10-30 18:49 ` André Almeida
1 sibling, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2026-10-29 11:03 UTC (permalink / raw)
To: Hungyu Lin
Cc: miklos, andrealmeid, linux-unionfs, linux-fsdevel, linux-kernel, stable
On Wed, Oct 28, 2026 at 4:40 PM Hungyu Lin <dennylin0707@gmail.com> wrote:
>
> ovl_lookup_single() compares every positive child's casefold flag with
> that of the overlay. On casefolded ext4, regular files do not inherit
> the casefold flag from their parent directory. Looking up an existing
> regular file on a casefolded overlay therefore fails with EREMOTE.
> Symlinks, FIFOs and whiteouts are rejected by the same check.
>
> Restrict the child consistency check to directories, along with the
> corresponding assertion in ovl_get_inode(). This allows nondirectory
> objects to be looked up without rejecting them or warning about their
> flags, while directories with inconsistent casefold settings are still
> rejected.
>
> Fixes: 16754d61dc69 ("ovl: Support mounting case-insensitive enabled layers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
> fs/overlayfs/inode.c | 2 +-
> fs/overlayfs/namei.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
> index 63906b3dafcb..4428c50c3185 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -1278,7 +1278,7 @@ struct inode *ovl_get_inode(struct super_block *sb,
> }
> ovl_fill_inode(inode, realinode->i_mode, realinode->i_rdev);
> ovl_inode_init(inode, oip, ino, fsid);
> - WARN_ON_ONCE(!!IS_CASEFOLDED(inode) != ofs->casefold);
> + WARN_ON_ONCE(is_dir && !!IS_CASEFOLDED(inode) != ofs->casefold);
>
> if (upperdentry && ovl_is_impuredir(sb, upperdentry))
> ovl_set_flag(OVL_IMPURE, inode);
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index ca899fdfaafd..023966d89f74 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -266,7 +266,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
> goto out_err;
> }
>
> - if (ofs->casefold != ovl_dentry_casefolded(this)) {
> + if (d_is_dir(this) && ofs->casefold != ovl_dentry_casefolded(this)) {
> warn = "child wrong casefold";
> err = -EREMOTE;
> goto out_warn;
> --
> 2.43.0
>
Applied to ovl-fixes.
Hungyu,
Thank you for the overlayfs patches.
I see that you are sending patches to several subsystem, so I assume that you
do not have any specific interest in overlayfs casefold issues particularly?
I am asking because I got some patches for overlayfs casefold which I do not
prioritize because I do not know how widely the feature is really in use.
If you are interested in reviewing or testing said patches, let me know
and I will send them to you.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: restrict casefold consistency checks to directories
2026-10-29 11:03 ` Amir Goldstein
@ 2026-10-29 16:44 ` Hungyu Lin
2026-10-30 11:54 ` Amir Goldstein
0 siblings, 1 reply; 5+ messages in thread
From: Hungyu Lin @ 2026-10-29 16:44 UTC (permalink / raw)
To: Amir Goldstein
Cc: miklos, andrealmeid, linux-unionfs, linux-fsdevel, linux-kernel, stable
> I am asking because I got some patches for overlayfs casefold which I do not
> prioritize because I do not know how widely the feature is really in use.
>
> If you are interested in reviewing or testing said patches, let me know
> and I will send them to you.
Hi Amir,
Thanks for applying the fix. Please send the casefold patches over;
I'd be happy to help test them.
Thanks,
Hungyu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: restrict casefold consistency checks to directories
2026-10-29 16:44 ` Hungyu Lin
@ 2026-10-30 11:54 ` Amir Goldstein
0 siblings, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2026-10-30 11:54 UTC (permalink / raw)
To: Hungyu Lin
Cc: miklos, andrealmeid, linux-unionfs, linux-fsdevel, linux-kernel, stable
On Thu, Oct 29, 2026 at 5:44 PM Hungyu Lin <dennylin0707@gmail.com> wrote:
>
> > I am asking because I got some patches for overlayfs casefold which I do not
> > prioritize because I do not know how widely the feature is really in use.
> >
> > If you are interested in reviewing or testing said patches, let me know
> > and I will send them to you.
>
> Hi Amir,
>
> Thanks for applying the fix. Please send the casefold patches over;
> I'd be happy to help test them.
Excellent. Sent you 3 patches.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: restrict casefold consistency checks to directories
2026-10-28 15:40 [PATCH] ovl: restrict casefold consistency checks to directories Hungyu Lin
2026-10-29 11:03 ` Amir Goldstein
@ 2026-10-30 18:49 ` André Almeida
1 sibling, 0 replies; 5+ messages in thread
From: André Almeida @ 2026-10-30 18:49 UTC (permalink / raw)
To: Hungyu Lin, amir73il
Cc: linux-unionfs, linux-fsdevel, linux-kernel, stable, miklos
Em 28/10/2026 12:40, Hungyu Lin escreveu:
> ovl_lookup_single() compares every positive child's casefold flag with
> that of the overlay. On casefolded ext4, regular files do not inherit
> the casefold flag from their parent directory. Looking up an existing
> regular file on a casefolded overlay therefore fails with EREMOTE.
> Symlinks, FIFOs and whiteouts are rejected by the same check.
>
> Restrict the child consistency check to directories, along with the
> corresponding assertion in ovl_get_inode(). This allows nondirectory
> objects to be looked up without rejecting them or warning about their
> flags, while directories with inconsistent casefold settings are still
> rejected.
>
> Fixes: 16754d61dc69 ("ovl: Support mounting case-insensitive enabled layers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-30 18:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 15:40 [PATCH] ovl: restrict casefold consistency checks to directories Hungyu Lin
2026-10-29 11:03 ` Amir Goldstein
2026-10-29 16:44 ` Hungyu Lin
2026-10-30 11:54 ` Amir Goldstein
2026-10-30 18:49 ` André Almeida
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®