Whamcloud - gitweb
Merge branch 'maint' into next
[tools/e2fsprogs.git] / e2fsck / problem.c
index e783148..a7da94d 100644 (file)
@@ -99,6 +99,9 @@ static const char *preen_msg[] = {
        "",                     /* 20 */
 };
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+
 static struct e2fsck_problem problem_table[] = {
 
        /* Pre-Pass 1 errors */
@@ -126,7 +129,7 @@ static struct e2fsck_problem problem_table[] = {
          "    e2fsck -b 8193 <@v>\n"
          " or\n"
          "    e2fsck -b 32768 <@v>\n\n"),
-         PROMPT_NONE, PR_FATAL },
+         PROMPT_NONE, 0 },
 
        /* Filesystem size is wrong */
        { PR_0_FS_SIZE_WRONG,
@@ -435,6 +438,20 @@ 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.  "),
@@ -445,6 +462,11 @@ static struct e2fsck_problem problem_table[] = {
          N_("First_meta_bg is too big.  (%N, max value %g).  "),
          PROMPT_CLEAR, 0 },
 
+       /* External journal has corrupt superblock */
+       { PR_0_EXT_JOURNAL_SUPER_CSUM_INVALID,
+         N_("External @j @S checksum does not match @S.  "),
+         PROMPT_FIX, PR_PREEN_OK },
+
        /* Pass 1 errors */
 
        /* Pass 1: Checking inodes, blocks, and sizes */
@@ -692,11 +714,6 @@ static struct e2fsck_problem problem_table[] = {
             "or append-only flag set.  "),
          PROMPT_CLEAR, PR_PREEN_OK | PR_PREEN_NO | PR_NO_OK },
 
-       /* Compression flag set on an inode when filesystem doesn't support it */
-       { PR_1_COMPR_SET,
-         N_("@i %i has @cion flag set on @f without @cion support.  "),
-         PROMPT_CLEAR, 0 },
-
        /* Non-zero size for device, fifo or socket inode */
        { PR_1_SET_NONZSIZE,
          N_("Special (@v/socket/fifo) @i %i has non-zero size.  "),
@@ -765,7 +782,7 @@ static struct e2fsck_problem problem_table[] = {
 
        /* Error allocating EA region allocation structure */
        { PR_1_EA_ALLOC_REGION_ABORT,
-         N_("@A @a @b %b.  "),
+         N_("@A @a region allocation structure.  "),
          PROMPT_NONE, PR_FATAL},
 
        /* Error EA allocation collision */
@@ -958,6 +975,38 @@ 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 seems to contain garbage */
+       { PR_1_INODE_IS_GARBAGE,
+         N_("@i %i seems to contain garbage.  "),
+         PROMPT_CLEAR, 0 },
+
+       /* 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 extended attribute is corrupt (allocation collision) */
+       { PR_1_INODE_EA_ALLOC_COLLISION,
+         N_("@i %i @a is corrupt (allocation collision).  "),
+         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, physical @b %b, len %N)\n"),
+         PROMPT_FIX, 0 },
+
+       /*
+        * Inode extended attribute block passes checks, but checksum does not
+        * match block.
+        */
+       { PR_1_EA_BLOCK_ONLY_CSUM_INVALID,
+         N_("@i %i @a @b %b passes checks, but checksum does not match @b.  "),
+         PROMPT_FIX, 0 },
+
        /*
         * Interior extent node logical offset doesn't match first node below it
         */
@@ -971,6 +1020,23 @@ static struct e2fsck_problem problem_table[] = {
          N_("@i %i, end of extent exceeds allowed value\n\t(logical @b %c, physical @b %b, len %N)\n"),
          PROMPT_CLEAR, 0 },
 
+       /* Inode has inline data, but superblock is missing INLINE_DATA feature. */
+       { PR_1_INLINE_DATA_FEATURE,
+         N_("@i %i has inline data, but @S is missing INLINE_DATA feature\n"),
+         PROMPT_CLEAR, PR_PREEN_OK },
+
+       /* INLINE_DATA feature is set in a non-inline-data filesystem */
+       { PR_1_INLINE_DATA_SET,
+         N_("@i %i has INLINE_DATA_FL flag on @f without inline data support.\n"),
+         PROMPT_CLEAR, 0 },
+
+       /*
+        * Inode block conflicts with critical metadata, skipping
+        * block checks
+        */
+       { PR_1_CRITICAL_METADATA_COLLISION,
+         N_("@i %i block %b conflicts with critical metadata, skipping block checks.\n"),
+         PROMPT_NONE, 0 },
 
        /* Directory inode block <block> should be at block <otherblock> */
        { PR_1_COLLAPSE_DBLOCK,
@@ -987,6 +1053,67 @@ static struct e2fsck_problem problem_table[] = {
          N_("@i %i logical @b %b (physical @b %c) violates cluster allocation rules.\nWill fix in pass 1B.\n"),
          PROMPT_NONE, 0 },
 
+       /* Inode has INLINE_DATA_FL flag but extended attribute not found */
+       { PR_1_INLINE_DATA_NO_ATTR,
+         N_("@i %i has INLINE_DATA_FL flag but @a not found.  "),
+         PROMPT_TRUNCATE, 0 },
+
+       /* Extents/inlinedata flag set on a device or socket inode */
+       { PR_1_SPECIAL_EXTENTS_IDATA,
+         N_("Special (@v/socket/fifo) file (@i %i) has extents\n"
+            "or inline-data flag set.  "),
+         PROMPT_CLEAR, PR_PREEN_OK | PR_PREEN_NO | PR_NO_OK },
+
+       /* Inode has extent header but inline data flag is set */
+       { PR_1_CLEAR_INLINE_DATA_FOR_EXTENT,
+         N_("@i %i has @x header but inline data flag is set.\n"),
+         PROMPT_FIX, 0 },
+
+       /* Inode seems to have inline data but extent flag is set */
+       { PR_1_CLEAR_EXTENT_FOR_INLINE_DATA,
+         N_("@i %i seems to have inline data but @x flag is set.\n"),
+         PROMPT_FIX, 0 },
+
+       /* Inode seems to have block map but inline data and extent flags set */
+       { PR_1_CLEAR_EXTENT_INLINE_DATA_FLAGS,
+         N_("@i %i seems to have @b map but inline data and @x flags set.\n"),
+         PROMPT_FIX, 0 },
+
+       /* Inode has inline data and extent flags but i_block contains junk */
+       { PR_1_CLEAR_EXTENT_INLINE_DATA_INODE,
+         N_("@i %i has inline data and @x flags set but i_block contains junk.\n"),
+         PROMPT_CLEAR_INODE, 0 },
+
+       /* Bad block list says the bad block list inode is bad */
+       { PR_1_BADBLOCKS_IN_BADBLOCKS,
+         N_("Bad block list says the bad block list @i is bad.  "),
+         PROMPT_CLEAR_INODE, 0 },
+
+       /* Error allocating extent region allocation structure */
+       { PR_1_EXTENT_ALLOC_REGION_ABORT,
+         N_("@A @x region allocation structure.  "),
+         PROMPT_NONE, PR_FATAL},
+
+       /* Inode has a duplicate extent mapping */
+       { PR_1_EXTENT_COLLISION,
+         N_("@i %i has a duplicate @x mapping\n\t(logical @b %c, @n physical @b %b, len %N)\n"),
+         PROMPT_CLEAR, 0 },
+
+       /* Error allocating memory for encrypted directory list */
+       { PR_1_ALLOCATE_ENCRYPTED_DIRLIST,
+         N_("@A memory for encrypted @d list\n"),
+         PROMPT_NONE, PR_FATAL },
+
+       /* Inode extent tree could be more shallow */
+       { PR_1_EXTENT_BAD_MAX_DEPTH,
+         N_("@i %i @x tree could be more shallow (%b; could be <= %c)\n"),
+         PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK },
+
+       /* Inode extent tree could be more shallow */
+       { PR_1_NO_BIGALLOC_BLOCKMAP_FILES,
+         N_("@i %i on bigalloc @f cannot be @b mapped.  "),
+         PROMPT_FIX, 0 },
+
        /* Inode has corrupt extent header */
        { PR_1_MISSING_EXTENT_HEADER,
          N_("@i %i has corrupt @x header.  "),
@@ -1035,6 +1162,11 @@ static struct e2fsck_problem problem_table[] = {
          N_("Error adjusting refcount for @a @b %b (@i %i): %m\n"),
          PROMPT_NONE, 0 },
 
+       /* Duplicate/bad block range in inode */
+       { PR_1B_DUP_RANGE,
+         " %b--%c",
+         PROMPT_NONE, PR_LATCH_DBLOCK | PR_PREEN_NOHDR },
+
        /* Pass 1C: Scan directories for inodes with multiply-claimed blocks. */
        { PR_1C_PASS_HEADER,
          N_("Pass 1C: Scanning directories for @is with @m @bs\n"),
@@ -1084,6 +1216,48 @@ static struct e2fsck_problem problem_table[] = {
        { PR_1D_CLONE_ERROR,
          N_("Couldn't clone file: %m\n"), PROMPT_NONE, 0 },
 
+       /* Pass 1E Extent tree optimization     */
+
+       /* Pass 1E: Optimizing extent trees */
+       { PR_1E_PASS_HEADER,
+         N_("Pass 1E: Optimizing @x trees\n"),
+         PROMPT_NONE, PR_PREEN_NOMSG },
+
+       /* Failed to optimize extent tree */
+       { PR_1E_OPTIMIZE_EXT_ERR,
+         N_("Failed to optimize @x tree %p (%i): %m\n"),
+         PROMPT_NONE, 0 },
+
+       /* Optimizing extent trees */
+       { PR_1E_OPTIMIZE_EXT_HEADER,
+         N_("Optimizing @x trees: "),
+         PROMPT_NONE, PR_MSG_ONLY },
+
+       /* Rebuilding extent tree %d */
+       { PR_1E_OPTIMIZE_EXT,
+         " %i",
+         PROMPT_NONE, PR_LATCH_OPTIMIZE_EXT | PR_PREEN_NOHDR},
+
+       /* Rebuilding extent tree end */
+       { PR_1E_OPTIMIZE_EXT_END,
+         "\n",
+         PROMPT_NONE, PR_PREEN_NOHDR },
+
+       /* Internal error: extent tree depth too large */
+       { PR_1E_MAX_EXTENT_TREE_DEPTH,
+         N_("Internal error: max extent tree depth too large (%b; expected=%c).\n"),
+         PROMPT_NONE, PR_FATAL },
+
+       /* Inode extent tree could be shorter */
+       { PR_1E_CAN_COLLAPSE_EXTENT_TREE,
+         N_("@i %i @x tree (at level %b) could be shorter.  "),
+         PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK },
+
+       /* Inode extent tree could be narrower */
+       { PR_1E_CAN_NARROW_EXTENT_TREE,
+         N_("@i %i @x tree (at (level %b) could be narrower.  "),
+         PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK },
+
        /* Pass 2 errors */
 
        /* Pass 2: Checking directory structure */
@@ -1414,6 +1588,41 @@ 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 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: @d passes checks but fails checksum.\n"),
+         PROMPT_FIX, PR_PREEN_OK },
+
+       /* inline directory inode size must be a multiple of 4 */
+       { PR_2_BAD_INLINE_DIR_SIZE,
+         N_("Inline @d @i %i size (%N) must be a multiple of 4.\n"),
+         PROMPT_FIX, 0 },
+
+       /* fixing size of inline directory inode failed */
+       { PR_2_FIX_INLINE_DIR_FAILED,
+         N_("Fixing size of inline @d @i %i failed.\n"),
+         PROMPT_TRUNCATE, 0 },
+
+       /* Encrypted directory entry is too short */
+       { PR_2_BAD_ENCRYPTED_NAME,
+         N_("Encrypted @E is too short.\n"),
+         PROMPT_CLEAR, 0 },
+
        /* Pass 3 errors */
 
        /* Pass 3: Checking directory connectivity */
@@ -1536,6 +1745,26 @@ static struct e2fsck_problem problem_table[] = {
          N_("/@l is not a @d (ino=%i)\n"),
          PROMPT_UNLINK, 0 },
 
+       /* Lost+found has inline data */
+       { PR_3_LPF_INLINE_DATA,
+         N_("/@l has inline data\n"),
+         PROMPT_CLEAR, 0 },
+
+       /* Cannot allocate /lost+found. */
+       { PR_3_LPF_NO_SPACE,
+         N_("Cannot allocate space for /@l.\nPlace lost files in root directory instead"),
+         PROMPT_NULL, 0 },
+
+       /* Delete some files and re-run e2fsck. */
+       { PR_3_NO_SPACE_TO_RECOVER,
+         N_("Insufficient space to recover lost files!\nMove data off the @f and re-run e2fsck.\n\n"),
+         PROMPT_NONE, 0 },
+
+       /* Lost+found is encrypted */
+       { PR_3_LPF_ENCRYPTED,
+         N_("/@l is encrypted\n"),
+         PROMPT_CLEAR, 0 },
+
        /* Pass 3A Directory Optimization       */
 
        /* Pass 3A: Optimizing directories */
@@ -1730,6 +1959,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 @B 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 @B 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 */
@@ -1777,8 +2016,10 @@ static struct latch_descr pr_latch_info[] = {
        { PR_LATCH_TOOBIG, PR_1_INODE_TOOBIG, 0 },
        { PR_LATCH_OPTIMIZE_DIR, PR_3A_OPTIMIZE_DIR_HEADER, PR_3A_OPTIMIZE_DIR_END },
        { PR_LATCH_BG_CHECKSUM, PR_0_GDT_CSUM_LATCH, 0 },
+       { PR_LATCH_OPTIMIZE_EXT, PR_1E_OPTIMIZE_EXT_HEADER, PR_1E_OPTIMIZE_EXT_END },
        { -1, 0, 0 },
 };
+#pragma GCC diagnostic pop
 
 static struct e2fsck_problem *find_problem(problem_t code)
 {