summaryrefslogtreecommitdiff
path: root/misc/tune2fs.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@collabora.com>2020-12-17 18:35:33 +0100
committerTheodore Ts'o <tytso@mit.edu>2021-01-27 22:09:31 -0500
commit1f9bb778a8e693f8d5f2fd7a26fd6b9fe2e3212a (patch)
treeb41141e3edaf056ed463bc78529340141449c821 /misc/tune2fs.c
parent3e994cc5b85e0021221fb3a8779bd08f9360b450 (diff)
downloade2fsprogs-1f9bb778a8e693f8d5f2fd7a26fd6b9fe2e3212a.tar.gz
tune2fs: allow enabling casefold feature after fs creation
The main reason we didn't allow this before was because !CASEFOLDED directories were expected to be normalized(). Since this is no longer the case, and as long as the encrypt feature is not enabled, it should be safe to enable this feature. Disabling the feature is trickier, since we need to make sure there are no existing +F directories in the filesystem. Leave that for a future patch. Also, enabling strict mode requires some filesystem-wide verification, so ignore that for now. Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/tune2fs.c')
-rw-r--r--misc/tune2fs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index e660309f..59041770 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -161,7 +161,8 @@ static __u32 ok_features[3] = {
EXT4_FEATURE_INCOMPAT_64BIT |
EXT4_FEATURE_INCOMPAT_ENCRYPT |
EXT4_FEATURE_INCOMPAT_CSUM_SEED |
- EXT4_FEATURE_INCOMPAT_LARGEDIR,
+ EXT4_FEATURE_INCOMPAT_LARGEDIR |
+ EXT4_FEATURE_INCOMPAT_CASEFOLD,
/* R/O compat */
EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
@@ -1514,6 +1515,18 @@ mmp_error:
}
}
+ if (FEATURE_ON(E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_CASEFOLD)) {
+ if (ext2fs_has_feature_encrypt(sb)) {
+ fputs(_("Cannot enable casefold feature on filesystems "
+ "with the encrypt feature enabled.\n"),
+ stderr);
+ return 1;
+ }
+
+ sb->s_encoding = EXT4_ENC_UTF8_12_1;
+ sb->s_encoding_flags = e2p_get_encoding_flags(sb->s_encoding);
+ }
+
if (sb->s_rev_level == EXT2_GOOD_OLD_REV &&
(sb->s_feature_compat || sb->s_feature_ro_compat ||
sb->s_feature_incompat))