From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 3/8] e2fsck: check the checksum seed feature flag is set correctly
Date: Fri, 04 Dec 2015 18:44:35 -0800 [thread overview]
Message-ID: <20151205024435.31087.90646.stgit@birch.djwong.org> (raw)
In-Reply-To: <20151205024416.31087.14808.stgit@birch.djwong.org>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
e2fsck/problem.c | 5 +++++
e2fsck/problem.h | 3 +++
e2fsck/super.c | 9 +++++++++
3 files changed, 17 insertions(+)
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index a7da94d..971b0ad 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -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 */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 3b92e41..b3f5b8f 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -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
*/
diff --git a/e2fsck/super.c b/e2fsck/super.c
index af6d680..e09c14c 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -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) &&
next prev parent reply other threads:[~2015-12-05 2:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-05 2:44 [PATCH 0/8] e2fsprogs: save checksum seeds; misc fixes Darrick J. Wong
2015-12-05 2:44 ` [PATCH 1/8] libext2fs: store checksum seed in superblock Darrick J. Wong
2015-12-05 2:44 ` [PATCH 2/8] tune2fs: allow user to turn on saving the checksum seed Darrick J. Wong
2015-12-05 2:44 ` Darrick J. Wong [this message]
2015-12-05 2:44 ` [PATCH 4/8] mke2fs: store checksum seed at format time Darrick J. Wong
2015-12-05 2:44 ` [PATCH 5/8] tests: check proper operation of metadata_csum_seed Darrick J. Wong
2015-12-05 2:44 ` [PATCH 6/8] filefrag: accommodate holes when calculating expected values Darrick J. Wong
2015-12-05 2:45 ` [PATCH 7/8] tune2fs: confirm dangerous operations Darrick J. Wong
2015-12-05 2:45 ` [PATCH 8/8] tune2fs: recover the journal Darrick J. Wong
2015-12-05 5:15 ` [PATCH 0/8] e2fsprogs: save checksum seeds; misc fixes Andreas Dilger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151205024435.31087.90646.stgit@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox