Whamcloud - gitweb
Fix memory leaks in e2fsck's journal.c, and remove some cases
[tools/e2fsprogs.git] / e2fsck / problem.c
index ac4493a..cee69a9 100644 (file)
@@ -112,7 +112,7 @@ static const struct e2fsck_problem problem_table[] = {
          N_("\nThe @S could not be read or does not describe a correct ext2\n"
          "@f.  If the @v is valid and it really contains an ext2\n"
          "@f (and not swap or ufs or something else), then the @S\n"
-  "is corrupt, and you might try running e2fsck with an alternate @S:\n"
+         "is corrupt, and you might try running e2fsck with an alternate @S:\n"
          "    e2fsck -b %S <@v>\n\n"),
          PROMPT_NONE, PR_FATAL },
 
@@ -179,29 +179,32 @@ static const struct e2fsck_problem problem_table[] = {
          N_("@S has a bad ext3 @j (@i %i).\n"),
          PROMPT_CLEAR, PR_PREEN_OK },
 
-       /* Superblock has a journal device (which we can't handle yet) */
-       { PR_0_JOURNAL_UNSUPP_DEV,
-         N_("@S has external ext3 @j @v (unsupported).\n"),
-         PROMPT_ABORT, PR_NO_OK | PR_AFTER_CODE, PR_0_JOURNAL_BAD_DEV },
+       /* The external journal has (unsupported) multiple filesystems */
+       { PR_0_JOURNAL_UNSUPP_MULTIFS,
+         N_("External @j has multiple @f users (unsupported).\n"),
+         PROMPT_NONE, PR_FATAL },
 
-       /* Superblock has a bad journal device */
-       { PR_0_JOURNAL_BAD_DEV,
-         N_("@S has a bad ext3 @j (@v %X).\n"),
-         PROMPT_CLEAR, PR_PREEN_OK },
+       /* Can't find external journal */
+       { PR_0_CANT_FIND_JOURNAL,
+         N_("Can't find external @j\n"),
+         PROMPT_NONE, PR_FATAL },
 
-       /* Superblock has a journal UUID (which we can't handle yet) */
-       { PR_0_JOURNAL_UNSUPP_UUID,
-         N_("@S has an ext3 @j UUID (unsupported).\n"),
-         PROMPT_ABORT, PR_NO_OK | PR_AFTER_CODE, PR_0_JOURNAL_BAD_UUID },
+       /* External journal has bad superblock */
+       { PR_0_EXT_JOURNAL_BAD_SUPER,
+         N_("External @j has bad @S\n"),
+         PROMPT_NONE, PR_FATAL },
 
        /* Superblock has a bad journal UUID */
        { PR_0_JOURNAL_BAD_UUID,
-         N_("@S has a bad ext3 @j (UUID %s).\n"),
-         PROMPT_CLEAR, PR_PREEN_OK },
+         N_("External @j does not support this @f\n"),
+         PROMPT_NONE, PR_FATAL },
 
        /* Journal has an unknown superblock type */
        { PR_0_JOURNAL_UNSUPP_SUPER,
-         N_("Ext3 @j @S is unknown type %N (unsupported).\n"),
+         N_("Ext3 @j @S is unknown type %N (unsupported).\n"
+            "It is likely that your copy of e2fsck is old and/or doesn't "
+            "support this @j format.\n"
+            "It is also possible the @j @S is corrupt.\n"),
          PROMPT_ABORT, PR_NO_OK | PR_AFTER_CODE, PR_0_JOURNAL_BAD_SUPER },
 
        /* Journal superblock is corrupt */
@@ -212,7 +215,7 @@ static const struct e2fsck_problem problem_table[] = {
        /* Superblock flag should be cleared */
        { PR_0_JOURNAL_HAS_JOURNAL,
          N_("@S doesn't have has_journal flag, but has ext3 @j %s.\n"),
-         PROMPT_DELETE, PR_PREEN_OK },
+         PROMPT_CLEAR, PR_PREEN_OK },
 
        /* Superblock flag is incorrect */
        { PR_0_JOURNAL_RECOVER_SET,
@@ -259,6 +262,21 @@ static const struct e2fsck_problem problem_table[] = {
          "@f has feature flag(s) set, but is a revision 0 @f.  ",
          PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
 
+       /* Journal superblock has an unknown read-only feature flag set */
+       { PR_0_JOURNAL_UNSUPP_ROCOMPAT,
+         N_("Ext3 @j @S has an unknown read-only feature flag set.\n"),
+         PROMPT_ABORT, 0 },
+
+       /* Journal superblock has an unknown incompatible feature flag set */
+       { PR_0_JOURNAL_UNSUPP_INCOMPAT,
+         N_("Ext3 @j @S has an unknown incompatible feature flag set.\n"),
+         PROMPT_ABORT, 0 },
+
+       /* Journal has unsupported version number */
+       { PR_0_JOURNAL_UNSUPP_VERSION,
+         N_("@j version not supported by this e2fsck.\n"),
+         PROMPT_ABORT, 0 },
        /* Pass 1 errors */
        
        /* Pass 1: Checking inodes, blocks, and sizes */
@@ -277,7 +295,7 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Reserved inode has bad mode */
        { PR_1_RESERVED_BAD_MODE,
-         N_("Reserved @i %i has bad mode.  "),
+         N_("Reserved @i %i %Q has bad mode.  "),
          PROMPT_CLEAR, PR_PREEN_OK },
 
        /* Deleted inode has zero dtime */
@@ -509,8 +527,8 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Immutable flag set on a device or socket inode */
        { PR_1_SET_IMMUTABLE,
-         N_("Special (@v/socket/fifo) @i %i has immutable or "
-            "append-only flag set.\n"),
+         N_("Special (@v/socket/fifo/symlink) file (@i %i) has immutable\n"
+            "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 */
@@ -529,10 +547,81 @@ static const struct e2fsck_problem problem_table[] = {
          PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
 
        /* Journal inode is not in use, but contains data */      
-       { PR1_JOURNAL_INODE_NOT_CLEAR,
+       { PR_1_JOURNAL_INODE_NOT_CLEAR,
          "@j @i is not in use, but contains data.  ",
          PROMPT_CLEAR, PR_PREEN_OK },    
          
+       /* Journal has bad mode */
+       { PR_1_JOURNAL_BAD_MODE,
+         N_("@j is not regular file.  "),
+         PROMPT_FIX, PR_PREEN_OK },
+
+       /* Deal with inodes that were part of orphan linked list */
+       { PR_1_LOW_DTIME,
+         N_("@i %i was part of the orphaned @i list.  "),
+         PROMPT_FIX, PR_LATCH_LOW_DTIME, 0 },    
+
+       /* Deal with inodes that were part of corrupted orphan linked
+          list (latch question) */
+       { PR_1_ORPHAN_LIST_REFUGEES,
+         N_("@is that were part of a corrupted orphan linked list found.  "),
+         PROMPT_FIX, 0 },                
+                 
+       /* Error allocating refcount structure */
+       { PR_1_ALLOCATE_REFCOUNT,
+         "@A refcount structure (%N): %m\n",
+         PROMPT_NONE, PR_FATAL },
+
+       /* Error reading extended attribute block */
+       { PR_1_READ_EA_BLOCK,
+         N_("Error reading @a @b %b for @i %i.  "),
+         PROMPT_CLEAR, 0 },
+
+       /* Invalid extended attribute block */
+       { PR_1_BAD_EA_BLOCK,
+         N_("@i %i has a bad @a @b %b.  "),
+         PROMPT_CLEAR, 0 },
+
+       /* Error reading Extended Attribute block while fixing refcount */
+       { PR_1_EXTATTR_READ_ABORT,
+         N_("Error reading @a @b %b (%m).  "),
+         PROMPT_ABORT, 0 },
+                 
+       /* Extended attribute reference count incorrect */
+       { PR_1_EXTATTR_REFCOUNT,
+         N_("@a @b %b has reference count %B, should be %N.  "),
+         PROMPT_FIX, 0 },
+                 
+       /* Error writing Extended Attribute block while fixing refcount */ 
+       { PR_1_EXTATTR_WRITE,
+         N_("Error writing @a @b %b (%m).  "),
+         PROMPT_ABORT, 0 },
+
+       /* Multiple EA blocks not supported */
+       { PR_1_EA_MULTI_BLOCK,
+         N_("@a @b %b has h_blocks > 1.  "),
+         PROMPT_CLEAR, 0},       
+
+       /* Error allocating EA region allocation structure */
+       { PR_1_EA_ALLOC_REGION,
+         N_("Error allocating @a @b %b.  "),
+         PROMPT_ABORT, 0},
+       
+       /* Error EA allocation collision */
+       { PR_1_EA_ALLOC_COLLISION,
+         N_("@a @b %b is corrupt (allocation collision).  "),
+         PROMPT_CLEAR, 0},
+       
+       /* Bad extended attribute name */
+       { PR_1_EA_BAD_NAME,
+         N_("@a @b %b is corrupt (invalid name).  "),
+         PROMPT_CLEAR, 0},       
+
+       /* Bad extended attribute value */
+       { PR_1_EA_BAD_VALUE,
+         N_("@a @b %b is corrupt (invalid value).  "),
+         PROMPT_CLEAR, 0},       
+                 
        /* Pass 1b errors */
 
        /* Pass 1B: Rescan for duplicate/bad blocks */
@@ -837,6 +926,16 @@ static const struct e2fsck_problem problem_table[] = {
          N_("@E has a zero-length name\n"),
          PROMPT_CLEAR, 0 },
 
+       /* Invalid fast symlink size */
+       { PR_2_SYMLINK_SIZE,
+         N_("@i %i (%Q) is a fast symlink with a bad size (%Is)\n"),
+         PROMPT_CLEAR, 0 },
+
+       /* i_file_acl (extended attribute block) is bad */
+       { PR_2_FILE_ACL_BAD,
+         N_("@a @b @F is invalid (%If).\n"),
+         PROMPT_CLEAR, 0 },
+
        /* Pass 3 errors */
 
        /* Pass 3: Checking directory connectivity */
@@ -1107,6 +1206,7 @@ static struct latch_descr pr_latch_info[] = {
        { PR_LATCH_BBITMAP, PR_5_BLOCK_BITMAP_HEADER, PR_5_BLOCK_BITMAP_END },
        { PR_LATCH_RELOC, PR_0_RELOCATE_HINT, 0 },
        { PR_LATCH_DBLOCK, PR_1B_DUP_BLOCK_HEADER, PR_1B_DUP_BLOCK_END },
+       { PR_LATCH_LOW_DTIME, PR_1_ORPHAN_LIST_REFUGEES, 0 },
        { -1, 0, 0 },
 };