[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250805-tonyk-overlayfs-v2-3-0e54281da318@igalia.com>
Date: Tue, 05 Aug 2025 00:09:07 -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 3/8] fs: Create sb_same_encoding() helper
For cases where a file lookup can go to different mount points (like in
overlayfs), both super blocks must have the same encoding and the same
flags. To help with that, create a sb_same_encoding() function.
Signed-off-by: André Almeida <andrealmeid@...lia.com>
---
include/linux/fs.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1948b2c828d3e83691f0b0892b4a7a87501c11db..413d4b2b7a41c0706324d01e71963bc481f383e4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3744,6 +3744,28 @@ static inline bool sb_has_encoding(const struct super_block *sb)
#endif
}
+/*
+ * Compare if two super blocks have the same encoding and flags
+ */
+static inline bool sb_same_encoding(const struct super_block *sb1,
+ const struct super_block *sb2)
+{
+#if IS_ENABLED(CONFIG_UNICODE)
+ if (sb1->s_encoding == sb2->s_encoding)
+ return true;
+
+ if (sb1->s_encoding && sb2->s_encoding &&
+ (sb1->s_encoding->version == sb2->s_encoding->version) &&
+ (sb1->s_encoding_flags == sb2->s_encoding_flags))
+ return true;
+ else
+ return false;
+#else
+ return true;
+#endif
+}
+
+
int may_setattr(struct mnt_idmap *idmap, struct inode *inode,
unsigned int ia_valid);
int setattr_prepare(struct mnt_idmap *, struct dentry *, struct iattr *);
--
2.50.1
Powered by blists - more mailing lists