diff mbox

[42/54] e2fsck: Verify and correct MMP checksum problems

Message ID 20120307000222.11945.34243.stgit@elm3b70.beaverton.ibm.com
State Superseded, archived
Delegated to: Theodore Ts'o
Headers show

Commit Message

Darrick J. Wong March 7, 2012, 12:02 a.m. UTC
Check and handle MMP checksum problems by resetting the block.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---
 e2fsck/problem.c |    5 +++++
 e2fsck/problem.h |    3 +++
 e2fsck/unix.c    |    5 +++++
 3 files changed, 13 insertions(+), 0 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 8c55721..91617bc 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -432,6 +432,11 @@  static struct e2fsck_problem problem_table[] = {
 	     "bits cannot be set simultaneously."),
 	  PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
 
+	/* Superblock has invalid MMP checksum. */
+	{ PR_0_MMP_CSUM_INVALID,
+	  N_("@S MMP block checksum does not match MMP block.  "),
+	  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 e47984c..f6f1eee 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -248,6 +248,9 @@  struct problem_context {
  */
 #define PR_0_META_AND_GDT_CSUM_SET		0x000044
 
+/* Superblock has invalid MMP checksum. */
+#define PR_0_MMP_CSUM_INVALID			0x000045
+
 /*
  * Pass 1 errors
  */
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 678ce9b..d3fb8f8 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1098,6 +1098,11 @@  check_error:
 			ext2fs_mmp_clear(fs);
 			retval = 0;
 		}
+	} else if (retval == EXT2_ET_MMP_CSUM_INVALID) {
+		if (fix_problem(ctx, PR_0_MMP_CSUM_INVALID, &pctx)) {
+			ext2fs_mmp_clear(fs);
+			retval = 0;
+		}
 	}
 	return retval;
 }