[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250805-tonyk-overlayfs-v2-7-0e54281da318@igalia.com>
Date: Tue, 05 Aug 2025 00:09:11 -0300
From: André Almeida <andrealmeid@...lia.com>
To: Miklos Szeredi <miklos@...redi.hu>, Amir Goldstein <amir73il@...il.com>,
Theodore Tso <tytso@....edu>, Gabriel Krisman Bertazi <krisman@...nel.org>
Cc: 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,
André Almeida <andrealmeid@...lia.com>
Subject: [PATCH RFC v2 7/8] ovl: Check casefold consistency in ovl stack
overlayfs supports case-insensitive filesystems as long as they are
consistent regarding its enabled status. If one layer has it enabled,
every other layer must have it enabled as well. Check if this
consistency is being respected, and return an error otherwise.
Signed-off-by: André Almeida <andrealmeid@...lia.com>
---
fs/overlayfs/namei.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 76d6248b625e7c58e09685e421aef616aadea40a..5dee504667911f04ce543f7977d0d4c4a1190cc7 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -238,18 +238,6 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
bool is_upper = d->layer->idx == 0;
char val;
- /*
- * We allow filesystems that are case-folding capable but deny composing
- * ovl stack from case-folded directories. If someone has enabled case
- * folding on a directory on underlying layer, the warranty of the ovl
- * stack is voided.
- */
- if (ovl_dentry_casefolded(base)) {
- warn = "case folded parent";
- err = -ESTALE;
- goto out_warn;
- }
-
this = ovl_lookup_positive_unlocked(d, name, base, namelen, drop_negative);
if (IS_ERR(this)) {
err = PTR_ERR(this);
@@ -259,9 +247,16 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
goto out_err;
}
- if (ovl_dentry_casefolded(this)) {
- warn = "case folded child";
- err = -EREMOTE;
+ /*
+ * We allow filesystems that are case-folding capable as long as the
+ * layers are consistently enabled in the stack, enabled for every layer
+ * or disabled in all layers. If someone has enabled case
+ * folding on a directory on underlying layer, the warranty of the ovl
+ * stack is voided.
+ */
+ if (ovl_dentry_casefolded(base) != ovl_dentry_casefolded(this)) {
+ warn = "casefold mismatch between parent and child";
+ err = -ESTALE;
goto out_warn;
}
--
2.50.1
Powered by blists - more mailing lists