Whamcloud - gitweb
LU-9501 mke2fs: avoid inode number error with large FS
[tools/e2fsprogs.git] / e2fsck / problem.c
index 11d277a..6939a87 100644 (file)
@@ -1318,6 +1318,16 @@ static struct e2fsck_problem problem_table[] = {
             "without deletion of an EA.\n"),
          PROMPT_FIX, 0 },
 
+       /* invalid inode creation time */
+       { PR_1_CRTIME_BAD,
+         N_("@i %i creation time (%t) invalid.\n"),
+         PROMPT_CLEAR, PR_PREEN_OK | PR_NO_OK },
+
+       /* Bad extended attribute value in inode */
+       { PR_1_SYMLINK_NUL,
+         N_("@i %i symlink missing NUL terminator.  "),
+         PROMPT_FIX, 0},
+
        /* Failed to goto block group */
        { PR_1_SCAN_GOTO,
          N_("failed to goto block group"),
@@ -1375,6 +1385,11 @@ static struct e2fsck_problem problem_table[] = {
          " %b--%c",
          PROMPT_NONE, PR_LATCH_DBLOCK | PR_PREEN_NOHDR, 0, 0, 0 },
 
+       /* Inode is badly corrupt (badness value = ) */
+       { PR_1B_INODE_TOOBAD,
+         N_("@i %i is badly corrupt (badness value = %N).  "),
+         PROMPT_CLEAR, PR_PREEN_OK },
+
        /* 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"),
@@ -1882,6 +1897,15 @@ static struct e2fsck_problem problem_table[] = {
           N_("Duplicate filename @E found.  "),
           PROMPT_CLEAR, 0, 0, 0, 0 },
 
+       /* Inode is badly corrupt (badness value = ) */
+       { PR_2_INODE_TOOBAD,
+         N_("@i %i is badly corrupt (badness value = %N).  "),
+         PROMPT_CLEAR, PR_PREEN_OK },
+
+       /* Directory entry dirdata length set incorrectly */
+       { PR_2_CLEAR_DIRDATA,
+         N_("@E dirdata length set incorrectly.\n"),
+         PROMPT_CLEAR, PR_PREEN_OK },
 
        /* Pass 3 errors */
 
@@ -2470,7 +2494,8 @@ static void print_problem(FILE *f, problem_t code, int answer, int fixed,
        fputs("/>\n", f);
 }
 
-int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
+int fix_problem_loc(e2fsck_t ctx, problem_t code, struct problem_context *pctx,
+                   int badness, const char *func, const int line)
 {
        ext2_filsys fs = ctx->fs;
        struct e2fsck_problem *ptr;
@@ -2481,6 +2506,10 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
        int             suppress = 0;
        int             fixed = 0;
 
+       /* ino is always set in pass1, where we will hit most badness */
+       if (pctx && pctx->ino != 0 && badness && code < PR_3_PASS_HEADER)
+               e2fsck_mark_inode_bad_loc(ctx, pctx, code, badness, func, line);
+
        ptr = find_problem(code);
        if (!ptr) {
                printf(_("Unhandled error code (0x%x)!\n"), code);
@@ -2528,7 +2557,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
        if (ptr->flags & PR_LATCH_MASK &&
            (ldesc = find_latch(ptr->flags & PR_LATCH_MASK)) != NULL) {
                if (ldesc->question && !(ldesc->flags & PRL_LATCHED)) {
-                       ans = fix_problem(ctx, ldesc->question, pctx);
+                       ans = fix_problem_loc(ctx, ldesc->question, pctx,
+                                             0, func, line);
                        if (ans == 1)
                                ldesc->flags |= PRL_YES;
                        if (ans == 0)
@@ -2629,7 +2659,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
                fatal_error(ctx, 0);
 
        if (ptr->flags & PR_AFTER_CODE)
-               answer = fix_problem(ctx, ptr->second_code, pctx);
+               answer = fix_problem_loc(ctx, ptr->second_code, pctx,
+                                        0, func, line);
 
        if (answer && (ptr->prompt != PROMPT_NONE) &&
            !(ptr->flags & PR_NOT_A_FIX)) {
@@ -2680,6 +2711,13 @@ void preenhalt(e2fsck_t ctx)
        return;
 }
 
+void e2fsck_mark_inode_bad_loc(e2fsck_t ctx,
+                              struct problem_context *pctx, __u32 code,
+                              int count, const char *func, const int line)
+{
+       return;
+}
+
 errcode_t
 profile_get_string(profile_t profile, const char *name, const char *subname,
                   const char *subsubname, const char *def_val,