From a60d9cf2a6f29a9e4b56d8f3ec9dde7675661dd8 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 1 Sep 2022 18:27:25 -0400 Subject: [PATCH] mke2fs: disable CSUM_SEED if the METADATA_CSUM feature is disabled by the user 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 --- misc/mke2fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index c111393..bde1e58 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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); -- 1.8.3.1