linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: "André Almeida" <andrealmeid@igalia.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, Theodore Tso <tytso@mit.edu>,
	 Gabriel Krisman Bertazi <krisman@kernel.org>,
	linux-unionfs@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	 kernel-dev@igalia.com
Subject: Re: [PATCH v4 8/9] ovl: Check for casefold consistency when creating new dentries
Date: Thu, 14 Aug 2025 15:06:25 +0200	[thread overview]
Message-ID: <CAOQ4uxjzmTCWesbGtD67u5yaUU4mRheObL=bCmLBoWFfPhzEYQ@mail.gmail.com> (raw)
In-Reply-To: <20250813-tonyk-overlayfs-v4-8-357ccf2e12ad@igalia.com>

On Thu, Aug 14, 2025 at 12:37 AM André Almeida <andrealmeid@igalia.com> wrote:
>
> In a overlayfs with casefold enabled, all new dentries should have
> casefold enabled as well. Check this at ovl_create_real()
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> Changes from v3:
> - New patch
> ---
>  fs/overlayfs/dir.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 70b8687dc45e8e33079c865ae302ac58464224a6..be8c5d02302de7a3ee63220a69f99a808fde3128 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -187,6 +187,11 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, struct dentry *parent,
>                         /* mkdir is special... */
>                         newdentry =  ovl_do_mkdir(ofs, dir, newdentry, attr->mode);
>                         err = PTR_ERR_OR_ZERO(newdentry);
> +                       /* expect to inherit casefolding from workdir/upperdir */
> +                       if (!err && ofs->casefold != ovl_dentry_casefolded(newdentry)) {
> +                               dput(newdentry);
> +                               err = -EINVAL;
> +                       }

If we do encounter a filesystem that does not inherit casefolding
(which is perfectly legal) the reason for this error is going to be very
hard for users to track down.

I think this calls for pr_warn_ratelimited() like we did for the lookup
warnings with inconsistent casefloding.

Thanks,
Amir.

  reply	other threads:[~2025-08-14 13:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 22:36 [PATCH v4 0/9] ovl: Enable support for casefold filesystems André Almeida
2025-08-13 22:36 ` [PATCH v4 1/9] ovl: Support mounting case-insensitive enabled filesystems André Almeida
2025-08-14  8:35   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 2/9] fs: Create new helper sb_encoding() André Almeida
2025-08-14 12:18   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 3/9] ovl: Create ovl_casefold() to support casefolded strncmp() André Almeida
2025-08-14 12:53   ` Amir Goldstein
2025-08-14 13:02     ` André Almeida
2025-08-14 13:20       ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 4/9] fs: Create sb_same_encoding() helper André Almeida
2025-08-14 12:19   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 5/9] ovl: Ensure that all layers have the same encoding André Almeida
2025-08-14 12:56   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 6/9] ovl: Set case-insensitive dentry operations for ovl sb André Almeida
2025-08-14 12:57   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 7/9] ovl: Add S_CASEFOLD as part of the inode flag to be copied André Almeida
2025-08-14 13:00   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 8/9] ovl: Check for casefold consistency when creating new dentries André Almeida
2025-08-14 13:06   ` Amir Goldstein [this message]
2025-08-13 22:36 ` [PATCH v4 9/9] ovl: Allow case-insensitive lookup André Almeida
2025-08-14  8:44   ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOQ4uxjzmTCWesbGtD67u5yaUU4mRheObL=bCmLBoWFfPhzEYQ@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=kernel-dev@igalia.com \
    --cc=krisman@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).