Whamcloud - gitweb
Merge branch 'maint' into next
[tools/e2fsprogs.git] / e2fsck / problem.c
index 7293819..897693a 100644 (file)
@@ -433,6 +433,25 @@ static struct e2fsck_problem problem_table[] = {
          N_("ext2fs_check_desc: %m\n"),
          PROMPT_NONE, 0 },
 
+       /*
+        * metadata_csum implies uninit_bg; both feature bits cannot
+        * be set simultaneously.
+        */
+       { PR_0_META_AND_GDT_CSUM_SET,
+         N_("@S metadata_csum supersedes uninit_bg; both feature "
+            "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},
+
+       /* 64bit is set but extents is unset. */
+       { PR_0_64BIT_WITHOUT_EXTENTS,
+         N_("@S 64bit filesystems needs extents to access the whole disk.  "),
+         PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
+
        /* Pass 1 errors */
 
        /* Pass 1: Checking inodes, blocks, and sizes */
@@ -946,6 +965,60 @@ static struct e2fsck_problem problem_table[] = {
          N_("@i %i has zero length extent\n\t(@n logical @b %c, physical @b %b)\n"),
          PROMPT_CLEAR, 0 },
 
+       /* inode checksum does not match inode */
+       { PR_1_INODE_CSUM_INVALID,
+         N_("@i %i checksum does not match @i.  "),
+         PROMPT_CLEAR, PR_PREEN_OK },
+
+       /* inode passes checks, but checksum does not match inode */
+       { PR_1_INODE_ONLY_CSUM_INVALID,
+         N_("@i %i passes checks, but checksum does not match @i.  "),
+         PROMPT_FIX, PR_PREEN_OK },
+
+       /* Inode extent block checksum does not match extent */
+       { PR_1_EXTENT_CSUM_INVALID,
+         N_("@i %i extent block checksum does not match extent\n\t(logical @b "
+            "%c, @n physical @b %b, len %N)\n"),
+         PROMPT_CLEAR, 0 },
+
+       /*
+        * Inode extent block passes checks, but checksum does not match
+        * extent
+        */
+       { PR_1_EXTENT_ONLY_CSUM_INVALID,
+         N_("@i %i extent block passes checks, but checksum does not match "
+            "extent\n\t(logical @b %c, @n physical @b %b, len %N)\n"),
+         PROMPT_FIX, 0 },
+
+       /* Extended attribute block checksum for inode does not match. */
+       { PR_1_EA_BLOCK_CSUM_INVALID,
+         N_("Extended attribute @a @b %b checksum for @i %i does not "
+            "match.  "),
+         PROMPT_CLEAR, 0 },
+
+       /*
+        * Extended attribute block passes checks, but checksum for inode does
+        * not match.
+        */
+       { PR_1_EA_BLOCK_ONLY_CSUM_INVALID,
+         N_("Extended attribute @a @b %b passes checks, but checksum for "
+            "@i %i does not match.  "),
+         PROMPT_FIX, 0 },
+
+       /*
+        * Interior extent node logical offset doesn't match first node below it
+        */
+       { PR_1_EXTENT_INDEX_START_INVALID,
+         N_("Interior @x node level %N of @i %i:\n"
+            "Logical start %b does not match logical start %c at next level.  "),
+         PROMPT_FIX, 0 },
+
+       /* Extent end is out of bounds for the tree */
+       { PR_1_EXTENT_END_OUT_OF_BOUNDS,
+         N_("@i %i, end of extent exceeds allowed value\n\t(logical @b %c, physical @b %b, len %N)\n"),
+         PROMPT_CLEAR, 0 },
+
+
        /* Pass 1b errors */
 
        /* Pass 1B: Rescan for duplicate/bad blocks */
@@ -1368,6 +1441,31 @@ static struct e2fsck_problem problem_table[] = {
          N_("i_file_acl_hi @F %N, @s zero.\n"),
          PROMPT_CLEAR, PR_PREEN_OK },
 
+       /* htree root node fails checksum */
+       { PR_2_HTREE_ROOT_CSUM_INVALID,
+         N_("@p @h %d: root node fails checksum\n"),
+         PROMPT_CLEAR_HTREE, PR_PREEN_OK },
+
+       /* htree internal node fails checksum */
+       { PR_2_HTREE_NODE_CSUM_INVALID,
+         N_("@p @h %d: internal node fails checksum\n"),
+         PROMPT_CLEAR_HTREE, PR_PREEN_OK },
+
+       /* leaf node fails checksum */
+       { PR_2_LEAF_NODE_CSUM_INVALID,
+         N_("@d @i %i, %B, offset %N: @d fails checksum\n"),
+         PROMPT_SALVAGE, PR_PREEN_OK },
+
+       /* leaf node has no checksum */
+       { PR_2_LEAF_NODE_MISSING_CSUM,
+         N_("@d @i %i, %B, offset %N: @d has no checksum\n"),
+         PROMPT_FIX, PR_PREEN_OK },
+
+       /* leaf node passes checks but fails checksum */
+       { PR_2_LEAF_NODE_ONLY_CSUM_INVALID,
+         N_("@d @i %i, %B, offset %N: @d passes checks but fails checksum\n"),
+         PROMPT_FIX, PR_PREEN_OK },
+
        /* Pass 3 errors */
 
        /* Pass 3: Checking directory connectivity */
@@ -1621,7 +1719,7 @@ static struct e2fsck_problem problem_table[] = {
        /* Free inodes count wrong */
        { PR_5_FREE_INODE_COUNT,
          N_("Free @is count wrong (%i, counted=%j).\n"),
-         PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
+         PROMPT_FIX, PR_PREEN_OK | PR_NO_OK | PR_PREEN_NOMSG },
 
        /* Free blocks count for group wrong */
        { PR_5_FREE_BLOCK_COUNT_GROUP,
@@ -1631,7 +1729,7 @@ static struct e2fsck_problem problem_table[] = {
        /* Free blocks count wrong */
        { PR_5_FREE_BLOCK_COUNT,
          N_("Free @bs count wrong (%b, counted=%c).\n"),
-         PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
+         PROMPT_FIX, PR_PREEN_OK | PR_NO_OK | PR_PREEN_NOMSG },
 
        /* Programming error: bitmap endpoints don't match */
        { PR_5_BMAP_ENDPOINTS,
@@ -1684,6 +1782,16 @@ static struct e2fsck_problem problem_table[] = {
          N_("@g %g @i(s) in use but @g is marked INODE_UNINIT\n"),
          PROMPT_FIX, PR_PREEN_OK },
 
+       /* Group N inode bitmap does not match checksum */
+       { PR_5_INODE_BITMAP_CSUM_INVALID,
+         N_("@g %g @i bitmap does not match checksum\n"),
+         PROMPT_FIX, PR_LATCH_IBITMAP | PR_PREEN_OK },
+
+       /* Group N block bitmap does not match checksum */
+       { PR_5_BLOCK_BITMAP_CSUM_INVALID,
+         N_("@g %g @b bitmap does not match checksum\n"),
+         PROMPT_FIX, PR_LATCH_BBITMAP | PR_PREEN_OK },
+
        /* Post-Pass 5 errors */
 
        /* Recreate journal if E2F_FLAG_JOURNAL_INODE flag is set */
@@ -1691,6 +1799,11 @@ static struct e2fsck_problem problem_table[] = {
          N_("Recreate @j"),
          PROMPT_NULL, PR_PREEN_OK | PR_NO_OK },
 
+       /* Update quota information if it is inconsistent */
+       { PR_6_UPDATE_QUOTAS,
+         N_("Update quota info for quota type %N"),
+         PROMPT_NULL, PR_PREEN_OK },
+
        { 0 }
 };
 
@@ -1784,11 +1897,11 @@ void clear_problem_context(struct problem_context *ctx)
 static void reconfigure_bool(e2fsck_t ctx, struct e2fsck_problem *ptr,
                             const char *key, int mask, const char *name)
 {
-       int     bool;
+       int     val;
 
-       bool = (ptr->flags & mask);
-       profile_get_boolean(ctx->profile, "problems", key, name, bool, &bool);
-       if (bool)
+       val = (ptr->flags & mask);
+       profile_get_boolean(ctx->profile, "problems", key, name, val, &val);
+       if (val)
                ptr->flags |= mask;
        else
                ptr->flags &= ~mask;
@@ -1811,7 +1924,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
                return 0;
        }
        if (!(ptr->flags & PR_CONFIG)) {
-               char    key[9], *new_desc;
+               char    key[9], *new_desc = NULL;
 
                sprintf(key, "0x%06x", code);