e2fsck: check the checksum seed feature flag is set correctly

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debian
Darrick J. Wong 2016-03-05 12:52:55 -05:00 committed by Theodore Ts'o
parent 2be9cd8655
commit 17f2fbf737
3 changed files with 17 additions and 0 deletions

View File

@ -467,6 +467,11 @@ static struct e2fsck_problem problem_table[] = {
N_("External @j @S checksum does not match @S. "),
PROMPT_FIX, PR_PREEN_OK },
/* metadata_csum_seed means nothing without metadata_csum */
{ PR_0_CSUM_SEED_WITHOUT_META_CSUM,
N_("@S metadata_csum_seed is not necessary without metadata_csum."),
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
/* Pass 1 errors */
/* Pass 1: Checking inodes, blocks, and sizes */

View File

@ -268,6 +268,9 @@ struct problem_context {
/* External journal has corrupt superblock */
#define PR_0_EXT_JOURNAL_SUPER_CSUM_INVALID 0x00004A
/* metadata_csum_seed means nothing without metadata_csum */
#define PR_0_CSUM_SEED_WITHOUT_META_CSUM 0x00004B
/*
* Pass 1 errors
*/

View File

@ -589,6 +589,15 @@ void check_super_block(e2fsck_t ctx)
ext2fs_group_desc_csum_set(fs, i);
}
/* We can't have ^metadata_csum,metadata_csum_seed */
if (!ext2fs_has_feature_metadata_csum(fs->super) &&
ext2fs_has_feature_csum_seed(fs->super) &&
fix_problem(ctx, PR_0_CSUM_SEED_WITHOUT_META_CSUM, &pctx)) {
ext2fs_clear_feature_csum_seed(fs->super);
fs->super->s_checksum_seed = 0;
ext2fs_mark_super_dirty(fs);
}
/* Is 64bit set and extents unset? */
if (ext2fs_has_feature_64bit(fs->super) &&
!ext2fs_has_feature_extents(fs->super) &&