]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: verify and correct MMP checksum problems
authorDarrick J. Wong <djwong@us.ibm.com>
Fri, 3 Aug 2012 00:47:45 +0000 (20:47 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 3 Aug 2012 00:47:45 +0000 (20:47 -0400)
Check and handle MMP checksum problems by resetting the block.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/problem.c
e2fsck/problem.h
e2fsck/unix.c

index c948fcd6ba63ddaca6874f8e6e785b12a53bfdf6..78b05bb6e29e62e2a534ba45c5d89312e039924c 100644 (file)
@@ -442,6 +442,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 */
index db135dccd3bb361256e716a285eeb5d728ecee4a..5caade4e203a90efaf02b0097b6da80dd6919f9c 100644 (file)
@@ -255,6 +255,9 @@ struct problem_context {
  */
 #define PR_0_META_AND_GDT_CSUM_SET             0x000046
 
+/* Superblock has invalid MMP checksum. */
+#define PR_0_MMP_CSUM_INVALID                  0x000047
+
 
 /*
  * Pass 1 errors
index e058d2b6871d139cc93b5aed314647a0bf5eaa58..d2b1bbd9610bb77ace918ccfec701d8ceb5c0b80 100644 (file)
@@ -1151,6 +1151,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;
 }