From nobody Sun Oct 5 05:29:28 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 5E6F125C6F3; Fri, 8 Aug 2025 20:59: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=1754686770; cv=none; b=SfTo58CaVDp+ANz4mIHBjSPZZEPNQTdlWVgro5GG96U3xa66JDy1K+cwOSCv9wCwCyFvYpL8QeFdZ8mKClLxCv0eTCIZawKuCBdV3VCwoBZEUN+QxDqkoG0EZ6CUrHSXOoFGxDmTNk85e6bFYBMp4lx37EQxG8Cbb51qK6dyw3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754686770; c=relaxed/simple; bh=q1lbE9HSCF1yjwRx8M5o+xiG7oe2jBvw8fhVmn5mcYY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZNTi2/WffW1Ay8mH7AHs+p1I69+EvmE9auZ5Dl1Gu09TGqOFZ9+jkxx8ZsJvbJDjyJb+1tmLmdtow3tLoj48bik6fjtSnlfxuN6f5lc7782mh47pBfcV8tvq9gOfZO8qqqPPDF3vWdLaC8w2Osfp9cIYzwCzGJUEqMzv3swIsMY= 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=aVvmi+wL; 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="aVvmi+wL" 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=zSQ8Tf8QHrXG591Xmuim+Lx3lqmCvhyjmipeObN9FzE=; b=aVvmi+wL00KjkyRw6GPTcULgiI UF5ODTwrhIERfLW/kCA/5Cc1uCBatPnK5a2nQM42J4nRKU2sv/p6JZIIYtabU9i3g4BXpqJajtFFm 1teu2OTZ/VM2exwbQVxEs12iurCcn4Ez0C+VYQ8W8ywUX78fKPgzk2LdZoLXN+bQsLGejqC1mj/Z6 r23k7UhI35t8Oh3EZIn4aut/nCXxT3Mb1mGW3JATp0b60OGfohtWj0jI4nsczA1kS4NCdnOjaPFP9 0RccrWHoQ2NKd7S32s6SRLl0Z3wcwx9QK3j3Joy4bWz3/lkxafj+kPGAtVukA+QYLNoL5XxPABMLc 4Nu/OWVQ==; Received: from [152.250.7.37] (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 1ukUBP-00BiQh-5G; Fri, 08 Aug 2025 22:59:23 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Fri, 08 Aug 2025 17:58:46 -0300 Subject: [PATCH RFC v3 4/7] 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: <20250808-tonyk-overlayfs-v3-4-30f9be426ba8@igalia.com> References: <20250808-tonyk-overlayfs-v3-0-30f9be426ba8@igalia.com> In-Reply-To: <20250808-tonyk-overlayfs-v3-0-30f9be426ba8@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 df85a76597e910d00323018f1d2cd720c5db921d..bcb7f5dbf9a32e4aa09bc41596b= e443851e21200 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