[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxikEukw8o_=SrH6w01bnjD0ZBmMrf3kzLuR1U++B2x4dQ@mail.gmail.com>
Date: Sat, 9 Aug 2025 12:07:56 +0200
From: Amir Goldstein <amir73il@...il.com>
To: André Almeida <andrealmeid@...lia.com>
Cc: Miklos Szeredi <miklos@...redi.hu>, Theodore Tso <tytso@....edu>,
Gabriel Krisman Bertazi <krisman@...nel.org>, linux-unionfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
kernel-dev@...lia.com
Subject: Re: [PATCH RFC v3 4/7] ovl: Ensure that all mount points have the
same encoding
On Fri, Aug 8, 2025 at 10:59 PM André Almeida <andrealmeid@...lia.com> wrote:
>
> When mounting different mount points with casefold support, they should
Different mount points in incorrect terminology, please use:
When merging layers from different filesystems with casefold enabled,
all layers should...
> use the same encoding version and have the same flags to avoid any kind
> of incompatibility issues.
>
> Signed-off-by: André Almeida <andrealmeid@...lia.com>
> ---
> fs/overlayfs/super.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index df85a76597e910d00323018f1d2cd720c5db921d..bcb7f5dbf9a32e4aa09bc41596be443851e21200 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -998,6 +998,7 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
> int err;
> unsigned int i;
> size_t nr_merged_lower;
> + struct super_block *sb1 = NULL;
>
> ofs->fs = kcalloc(ctx->nr + 2, sizeof(struct ovl_sb), GFP_KERNEL);
> if (ofs->fs == NULL)
> @@ -1024,6 +1025,8 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
> if (ovl_upper_mnt(ofs)) {
> ofs->fs[0].sb = ovl_upper_mnt(ofs)->mnt_sb;
> ofs->fs[0].is_lower = false;
> +
> + sb1 = ofs->fs[0].sb;
> }
>
> nr_merged_lower = ctx->nr - ctx->nr_data;
> @@ -1067,6 +1070,9 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
> return err;
> }
>
> + if (!sb1)
> + sb1 = mnt->mnt_sb;
> +
> /*
> * Make lower layers R/O. That way fchmod/fchown on lower file
> * will fail instead of modifying lower fs.
> @@ -1083,6 +1089,11 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
> l->name = NULL;
> ofs->numlayer++;
> ofs->fs[fsid].is_lower = true;
> +
> + if (!sb_same_encoding(sb1, mnt->mnt_sb)) {
> + pr_err("all layers must have the same encoding\n");
> + return -EINVAL;
> + }
> }
This condition is too strict IMO.
It is only needed if ofs->casefold is enabled.
When casefolding is not enabled for the ovl mount,
we need not care about the layers encoding.
This is related to another comment I have on path 7 -
ofs->casefold config should be introduced much earlier in the
series, so that it could be used in conditions like this one and
in the S_CASEFOLD assertions after copying inode flags.
Thanks,
Amir.
Powered by blists - more mailing lists