summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-10-03 22:14:24 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2025-10-03 22:14:24 +0300
commitcf06d791f840be97f726ecaaea872a876ff62436 (patch)
tree7b97db48f901b0c3e4df7ab5f225b1108812a0e2 /include/linux
parent9b0d551bcc05fa4786689544a2845024db1d41b6 (diff)
parentad1423922781e6552f18d055a5742b1cff018cdc (diff)
downloadlinux-cf06d791f840be97f726ecaaea872a876ff62436.tar.xz
Merge tag 'ovl-update-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs
Pull overlayfs updates from Amir Goldstein: - Work by André Almeida to support case-insensitive overlayfs Underlying case-insensitive filesystems casefolding is per directory, but for overlayfs it is all-or-nothing. It supports layers where all directories are casefolded (with same encoding) or layers where no directories are casefolded. - A fix for a "bug" in Neil's ovl directory lock changes, which only manifested itself with casefold enabled layers which may return an unhashed negative dentry from lookup. * tag 'ovl-update-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs: ovl: make sure that ovl_create_real() returns a hashed dentry ovl: Support mounting case-insensitive enabled layers ovl: Check for casefold consistency when creating new dentries ovl: Add S_CASEFOLD as part of the inode flag to be copied ovl: Set case-insensitive dentry operations for ovl sb ovl: Ensure that all layers have the same encoding ovl: Create ovl_casefold() to support casefolded strncmp() ovl: Prepare for mounting case-insensitive enabled layers fs: Create sb_same_encoding() helper fs: Create sb_encoding() helper
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index caa8e8879f4b..1f4a1c570a2a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3739,12 +3739,35 @@ static inline bool generic_ci_validate_strict_name(struct inode *dir,
}
#endif
+static inline struct unicode_map *sb_encoding(const struct super_block *sb)
+{
+#if IS_ENABLED(CONFIG_UNICODE)
+ return sb->s_encoding;
+#else
+ return NULL;
+#endif
+}
+
static inline bool sb_has_encoding(const struct super_block *sb)
{
+ return !!sb_encoding(sb);
+}
+
+/*
+ * 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)
- return !!sb->s_encoding;
+ if (sb1->s_encoding == sb2->s_encoding)
+ return true;
+
+ return (sb1->s_encoding && sb2->s_encoding &&
+ (sb1->s_encoding->version == sb2->s_encoding->version) &&
+ (sb1->s_encoding_flags == sb2->s_encoding_flags));
#else
- return false;
+ return true;
#endif
}