Whamcloud - gitweb
AOSP: ANDROID: tune2fs: Support encrypt+casefold
authorDaniel Rosenberg <drosen@google.com>
Thu, 11 Jun 2020 04:21:42 +0000 (21:21 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 28 Jan 2021 04:46:39 +0000 (23:46 -0500)
In preparation for upcoming kernel changes that will make the kernel
support both encryption and casefolding at the same time, allow tune2fs
to enable both features at the same time.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Google-Bug-Id: 138322712
Test: Create fs with casefold and encryption enabled via tune2fs

Change-Id: I36537a8b6dc5e2997b7016212f9b574c76673067
From AOSP commit: 44ac9dccd9853cc9807f0d6ce952bdcdeb93954a

misc/tune2fs.c

index 15fa36f..cdf343c 100644 (file)
@@ -1419,12 +1419,6 @@ mmp_error:
        }
 
        if (FEATURE_ON(E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_ENCRYPT)) {
-               if (ext2fs_has_feature_casefold(sb)) {
-                       fputs(_("Cannot enable encrypt feature on filesystems "
-                               "with the encoding feature enabled.\n"),
-                             stderr);
-                       return 1;
-               }
                fs->super->s_encrypt_algos[0] =
                        EXT4_ENCRYPTION_MODE_AES_256_XTS;
                fs->super->s_encrypt_algos[1] =
@@ -1432,12 +1426,6 @@ 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;
-               }
                if (mount_flags & EXT2_MF_MOUNTED) {
                        fputs(_("The casefold feature may only be enabled when "
                                "the filesystem is unmounted.\n"), stderr);
@@ -2190,11 +2178,6 @@ static int parse_extended_opts(ext2_filsys fs, const char *opts)
                                r_usage++;
                                continue;
                        }
-                       if (ext2fs_has_feature_encrypt(sb)) {
-                               fprintf(stderr, _("error: Cannot enable casefolding if encryption is set\n"));
-                               r_usage++;
-                               continue;
-                       }
                        if (mount_flags & EXT2_MF_MOUNTED) {
                                fputs(_("The casefold feature may only be enabled when "
                                        "the filesystem is unmounted.\n"), stderr);