From nobody Sun Oct 5 12:49:52 2025 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65EBF2AF03; Tue, 5 Aug 2025 03:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754363371; cv=none; b=cqtOX1r/1JG3HL1RpRAuG16G6mi2YMfNpejZIjBmF4GBnBd9a6KC8NIuExCF75BHkKfeNDT2RMGubYc0W/0rf2dpYhlzgWCEqGp3rtSWjPscYdg6X5TbMAn7y4Nejd4p22jHPc163XlPfDWwxRjsDL9T1gyYonvKj1q+/HYO/ps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754363371; c=relaxed/simple; bh=5IPxB+ennw3I1nBRGMF7zsWHckDZLsz9IvAqp7Bwcsk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ml/IdQHv2YQx59yLrXr955gGRipsNP0iYJSJUVTjmT2T0XwUdTwxs9wTjcu1ZpziGAsZXbWT8D3cMGjpBhqF6h2cGY2lFGRK4dzeiXtNy1gx2g+iDMUcic7+7X5Uf1WK7W+YBu8eO9EdpxyT76gqcly5JZUM6Xp8V6ohLpDbgRs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=ZKZQ7dx4; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="ZKZQ7dx4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ojr9sG0RRJKao/SYLMHXpb4M+5kUiC+kbpn9/C/Ofw4=; b=ZKZQ7dx45JOoO3Mg1wBFlRkQ0M OWBfS3CNRSDmgXvrWzeOfXVL3BZv8hlOdvopil3vQX1XQlq0a0wrvAzh9IIaNf0MY3pxrwdAOWJJc BpRzXphhAzet0l9R1+wR+Bii9PM7pgzYt4als1oiJjFFMie29Y/zb4wY8WUTyrNN/figifbQ2C64J cIeiE9MgC5USOFvxcdRtRI66dpLMJlIfUOL5S0OMWe7h4KkJ8SxmhGoyvUx5zESlyLzC+g54Smbz+ RSgmrKwRCPQFMvpuMC1GVyJB10vLFr6k98bj7mdhwTUMqmeS3lk2LQbvkjmtTsB3NADEP6qjAnfPI 5ifAvwIw==; Received: from [191.204.199.202] (helo=[192.168.15.100]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uj83J-009TiJ-Mm; Tue, 05 Aug 2025 05:09:25 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Tue, 05 Aug 2025 00:09:08 -0300 Subject: [PATCH RFC v2 4/8] ovl: Ensure that all mount points have the same encoding Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250805-tonyk-overlayfs-v2-4-0e54281da318@igalia.com> References: <20250805-tonyk-overlayfs-v2-0-0e54281da318@igalia.com> In-Reply-To: <20250805-tonyk-overlayfs-v2-0-0e54281da318@igalia.com> To: Miklos Szeredi , Amir Goldstein , Theodore Tso , Gabriel Krisman Bertazi Cc: linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , Christian Brauner , Jan Kara , kernel-dev@igalia.com, =?utf-8?q?Andr=C3=A9_Almeida?= X-Mailer: b4 0.14.2 When mounting different mount points with casefold support, they should use the same encoding version and have the same flags to avoid any kind of incompatibility issues. Signed-off-by: Andr=C3=A9 Almeida --- fs/overlayfs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 4afa91882075110fdeb5e265ce207236c9eff28e..cfe8010616414a5ec0421b9ac59= 47596bfd0a5bd 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -998,6 +998,7 @@ static int ovl_get_layers(struct super_block *sb, struc= t ovl_fs *ofs, int err; unsigned int i; size_t nr_merged_lower; + struct super_block *sb1 =3D NULL; =20 ofs->fs =3D kcalloc(ctx->nr + 2, sizeof(struct ovl_sb), GFP_KERNEL); if (ofs->fs =3D=3D NULL) @@ -1024,6 +1025,8 @@ static int ovl_get_layers(struct super_block *sb, str= uct ovl_fs *ofs, if (ovl_upper_mnt(ofs)) { ofs->fs[0].sb =3D ovl_upper_mnt(ofs)->mnt_sb; ofs->fs[0].is_lower =3D false; + + sb1 =3D ofs->fs[0].sb; } =20 nr_merged_lower =3D ctx->nr - ctx->nr_data; @@ -1067,6 +1070,9 @@ static int ovl_get_layers(struct super_block *sb, str= uct ovl_fs *ofs, return err; } =20 + if (!sb1) + sb1 =3D 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, st= ruct ovl_fs *ofs, l->name =3D NULL; ofs->numlayer++; ofs->fs[fsid].is_lower =3D true; + + if (!sb_same_encoding(sb1, mnt->mnt_sb)) { + pr_err("all layers must have the same encoding\n"); + return -EINVAL; + } } =20 /* --=20 2.50.1