]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: disable CSUM_SEED if the METADATA_CSUM feature is disabled by the user
authorTheodore Ts'o <tytso@mit.edu>
Thu, 1 Sep 2022 22:27:25 +0000 (18:27 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 1 Sep 2022 22:27:25 +0000 (18:27 -0400)
If the CSUM_SEED feature is enabled by default, and the user disables
metadata_csum, then also disable CSUM_SEED, since a file system with
csum_seed but not metadata_csum is not valid.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index c111393aa6e73c7741b6de8999c1667cb958be1c..bde1e582e3fac6734a18ffb6600df73e12dc5cbc 100644 (file)
@@ -1576,6 +1576,7 @@ static void PRS(int argc, char *argv[])
        int             show_version_only = 0, is_device = 0;
        unsigned long long num_inodes = 0; /* unsigned long long to catch too-large input */
        int             default_orphan_file = 0;
+       int             default_csum_seed = 0;
        errcode_t       retval;
        char *          oldpath = getenv("PATH");
        char *          extended_opts = 0;
@@ -2135,11 +2136,15 @@ profile_error:
         */
        if (ext2fs_has_feature_orphan_file(&fs_param))
                default_orphan_file = 1;
+       if (ext2fs_has_feature_csum_seed(&fs_param))
+               default_csum_seed = 1;
        if (fs_features)
                edit_feature(fs_features, &fs_param.s_feature_compat);
        /* Silently disable orphan_file if user chose fs without journal */
        if (default_orphan_file && !ext2fs_has_feature_journal(&fs_param))
                ext2fs_clear_feature_orphan_file(&fs_param);
+       if (default_csum_seed && !ext2fs_has_feature_metadata_csum(&fs_param))
+               ext2fs_clear_feature_csum_seed(&fs_param);
        if (tmp)
                free(tmp);
        (void) ext2fs_free_mem(&fs_features);