Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ovl: Prepare for mounting case-insensitive enabled layers

Prepare for mounting layers with case-insensitive dentries in order to
supporting such layers in overlayfs, while enforcing uniform casefold
layers.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Gabriel Krisman Bertazi <gabriel@krisman.be>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>

authored by

André Almeida and committed by
Amir Goldstein
5fbf73c7 23253e27

+14 -3
+1
fs/overlayfs/ovl_entry.h
··· 91 91 struct mutex whiteout_lock; 92 92 /* r/o snapshot of upperdir sb's only taken on volatile mounts */ 93 93 errseq_t errseq; 94 + bool casefold; 94 95 }; 95 96 96 97 /* Number of lower layers, not including data-only layers */
+12 -3
fs/overlayfs/params.c
··· 276 276 static int ovl_mount_dir_check(struct fs_context *fc, const struct path *path, 277 277 enum ovl_opt layer, const char *name, bool upper) 278 278 { 279 + bool is_casefolded = ovl_dentry_casefolded(path->dentry); 279 280 struct ovl_fs_context *ctx = fc->fs_private; 281 + struct ovl_fs *ofs = fc->s_fs_info; 280 282 281 283 if (!d_is_dir(path->dentry)) 282 284 return invalfc(fc, "%s is not a directory", name); 283 285 284 286 /* 285 287 * Allow filesystems that are case-folding capable but deny composing 286 - * ovl stack from case-folded directories. 288 + * ovl stack from inconsistent case-folded directories. 287 289 */ 288 - if (ovl_dentry_casefolded(path->dentry)) 289 - return invalfc(fc, "case-insensitive directory on %s not supported", name); 290 + if (!ctx->casefold_set) { 291 + ofs->casefold = is_casefolded; 292 + ctx->casefold_set = true; 293 + } 294 + 295 + if (ofs->casefold != is_casefolded) { 296 + return invalfc(fc, "case-%ssensitive directory on %s is inconsistent", 297 + is_casefolded ? "in" : "", name); 298 + } 290 299 291 300 if (ovl_dentry_weird(path->dentry)) 292 301 return invalfc(fc, "filesystem on %s not supported", name);
+1
fs/overlayfs/params.h
··· 33 33 struct ovl_opt_set set; 34 34 struct ovl_fs_context_layer *lower; 35 35 char *lowerdir_all; /* user provided lowerdir string */ 36 + bool casefold_set; 36 37 }; 37 38 38 39 int ovl_init_fs_context(struct fs_context *fc);