Whamcloud - gitweb
Fix memory leaks in e2fsck's journal.c, and remove some cases
[tools/e2fsprogs.git] / e2fsck / problem.c
index 5a05387..cee69a9 100644 (file)
@@ -110,16 +110,16 @@ static const struct e2fsck_problem problem_table[] = {
        /* Superblock corrupt */
        { PR_0_SB_CORRUPT,
          N_("\nThe @S could not be read or does not describe a correct ext2\n"
-         "@f.  If the device is valid and it really contains an 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"
-         "    e2fsck -b %S <device>\n\n"),
+         "is corrupt, and you might try running e2fsck with an alternate @S:\n"
+         "    e2fsck -b %S <@v>\n\n"),
          PROMPT_NONE, PR_FATAL },
 
        /* Filesystem size is wrong */
        { PR_0_FS_SIZE_WRONG,
          N_("The @f size (according to the @S) is %b @bs\n"
-         "The physical size of the device is %c @bs\n"
+         "The physical size of the @v is %c @bs\n"
          "Either the @S or the partition table is likely to be corrupt!\n"),
          PROMPT_ABORT, 0 },
 
@@ -162,7 +162,7 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Error determing physical device size of filesystem */
        { PR_0_GETSIZE_ERROR,     
-         N_("Error determining size of the physical device: %m\n"),
+         N_("Error determining size of the physical @v: %m\n"),
          PROMPT_NONE, PR_FATAL },
 
        /* Inode count in superblock is incorrect */
@@ -176,52 +176,55 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Journal inode is invalid */
        { PR_0_JOURNAL_BAD_INODE,
-         N_("@S has a bad ext3 journal (@i %N).\n"),
+         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 journal device (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 journal (device %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 journal 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 journal (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 journal @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 */
        { PR_0_JOURNAL_BAD_SUPER,
-         N_("Ext3 journal @S is corrupt.\n"),
+         N_("Ext3 @j @S is corrupt.\n"),
          PROMPT_FIX, PR_PREEN_OK },
 
        /* Superblock flag should be cleared */
        { PR_0_JOURNAL_HAS_JOURNAL,
-         N_("@S doesn't have has_journal flag, but has ext3 journal %s.\n"),
-         PROMPT_DELETE, PR_PREEN_OK },
+         N_("@S doesn't have has_journal flag, but has ext3 @j %s.\n"),
+         PROMPT_CLEAR, PR_PREEN_OK },
 
        /* Superblock flag is incorrect */
        { PR_0_JOURNAL_RECOVER_SET,
-         N_("@S has ext3 needs_recovery flag set, but no journal.\n"),
+         N_("@S has ext3 needs_recovery flag set, but no @j.\n"),
          PROMPT_CLEAR, PR_PREEN_OK },
 
        /* Journal should be reset */
        { PR_0_JOURNAL_RESET_JOURNAL,
-         N_("*** WARNING *** leaving data in the journal may be DANGEROUS.\n"),
+         N_("*** WARNING *** leaving data in the @j may be DANGEROUS.\n"),
          PROMPT_NONE, PR_PREEN_NOMSG|PR_AFTER_CODE, PR_0_JOURNAL_RESET_PROMPT},
 
        /* Journal should be reset */
@@ -229,6 +232,51 @@ static const struct e2fsck_problem problem_table[] = {
          N_("ext3 recovery flag clear, but journal has data.\n"),
          PROMPT_CLEAR, PR_PREEN_OK|PR_PREEN_NOMSG },
 
+       /* Clearing orphan inode */
+       { PR_0_ORPHAN_CLEAR_INODE,
+         N_("%s @o @i %i (uid=%Iu, gid=%Ig, mode=%Im, size=%Is)\n"),
+         PROMPT_NONE, 0 },
+
+       /* Illegal block found in orphaned inode */
+       { PR_0_ORPHAN_ILLEGAL_BLOCK_NUM,
+          N_("@I @b #%B (%b) found in @o @i %i.\n"),
+         PROMPT_NONE, 0 },
+                 
+       /* Already cleared block found in orphaned inode */
+       { PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
+          N_("Already cleared @b #%B (%b) found in @o @i %i.\n"),
+         PROMPT_NONE, 0 },
+  
+       /* Illegal orphan inode in superblock */
+       { PR_0_ORPHAN_ILLEGAL_HEAD_INODE,
+         N_("@I @o @i %i in @S.\n"),
+         PROMPT_NONE, 0 },
+
+       /* Illegal inode in orphaned inode list */
+       { PR_0_ORPHAN_ILLEGAL_INODE,
+         N_("@I @i %i in @o @i list.\n"),
+         PROMPT_NONE, 0 },
+
+       /* Filesystem revision is 0, but feature flags are set */
+       { PR_0_FS_REV_LEVEL,
+         "@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 */
@@ -247,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 */
@@ -300,7 +348,7 @@ static const struct e2fsck_problem problem_table[] = {
          N_("@i %i, i_@bs is %Ib, @s %N.  "),
          PROMPT_FIX, PR_PREEN_OK },
 
-       /* Illegal block number in inode */
+       /* Illegal blocknumber in inode */
        { PR_1_ILLEGAL_BLOCK_NUM,
          N_("@I @b #%B (%b) in @i %i.  "),
          PROMPT_CLEAR, PR_LATCH_BLOCK },
@@ -445,18 +493,18 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Error while iterating over blocks */
        { PR_1_BLOCK_ITERATE,
-         N_("Error while iterating over blocks in @i %i: %m\n"),
+         N_("Error while iterating over @bs in @i %i: %m\n"),
          PROMPT_NONE, PR_FATAL },
 
        /* Error while storing inode count information */         
        { PR_1_ICOUNT_STORE,
-         N_("Error storing @i count information (inode=%i, count=%N): %m\n"),
+         N_("Error storing @i count information (@i=%i, count=%N): %m\n"),
          PROMPT_NONE, PR_FATAL },
 
        /* Error while storing directory block information */     
        { PR_1_ADD_DBLOCK,
          N_("Error storing @d @b information "
-         "(inode=%i, block=%b, num=%N): %m\n"),
+         "(@i=%i, @b=%b, num=%N): %m\n"),
          PROMPT_NONE, PR_FATAL },
 
        /* Error while reading inode (for clearing) */    
@@ -479,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 (device/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 */
@@ -490,9 +538,90 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Non-zero size for device, fifo or socket inode */
        { PR_1_SET_NONZSIZE,
-         "Special (device/socket/fifo) @i %i has non-zero size.  ",
+         "Special (@v/socket/fifo) @i %i has non-zero size.  ",
          PROMPT_FIX, PR_PREEN_OK },
+
+       /* Filesystem revision is 0, but feature flags are set */
+       { PR_1_FS_REV_LEVEL,
+         "@f has feature flag(s) set, but is a revision 0 @f.  ",
+         PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
+
+       /* Journal inode is not in use, but contains data */      
+       { 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 */
@@ -526,7 +655,11 @@ static const struct e2fsck_problem problem_table[] = {
          N_("@A @i @B (inode_dup_map): %m\n"),
          PROMPT_NONE, PR_FATAL },
 
-
+       /* Error while iterating over blocks */
+       { PR_1B_BLOCK_ITERATE,
+         N_("Error while iterating over @bs in @i %i (%s): %m\n"),
+         PROMPT_NONE, 0 },
+                 
        /* Pass 1C: Scan directories for inodes with dup blocks. */
        { PR_1C_PASS_HEADER,
          N_("Pass 1C: Scan directories for @is with dup @bs.\n"),
@@ -700,12 +833,12 @@ static const struct e2fsck_problem problem_table[] = {
 
        /* Illegal character device inode */
        { PR_2_BAD_CHAR_DEV,
-         N_("@i %i (%Q) is an @I character device.\n"),
+         N_("@i %i (%Q) is an @I character @v.\n"),
          PROMPT_CLEAR, 0 },
 
        /* Illegal block device inode */
        { PR_2_BAD_BLOCK_DEV,
-         N_("@i %i (%Q) is an @I @b device.\n"),
+         N_("@i %i (%Q) is an @I @b @v.\n"),
          PROMPT_CLEAR, 0 },
 
        /* Duplicate '.' entry */
@@ -793,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 */
@@ -1063,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 },
 };