]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
ChangeLog, journal.c, problem.c, problem.h:
authorTheodore Ts'o <tytso@mit.edu>
Wed, 23 May 2001 22:19:47 +0000 (22:19 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 23 May 2001 22:19:47 +0000 (22:19 +0000)
  journal.c (e2fsck_journal_reset_super): Fix bug; the reset journal
   wasn't getting written out to disk since the dirty bit wasn't being
   set on the buffer.
   (e2fsck_journal_load): Don't print an error message if the journal
   version number is wrong; just return a error code reflecting this
   fact.  If the block type in the journal superblcok is obviously not a
   version number, report the journal is corrupted.
   (e2fsck_check_ext3_journal): On an unsupported journal version, prompt
   to abort by default, but then offer a chance to clear the journal as
   corrupt.
  problem.c, problem.h (PR_0_JOURNAL_UNSUPP_VERSION): Added new problem code.

e2fsck/ChangeLog
e2fsck/journal.c
e2fsck/problem.c
e2fsck/problem.h

index 12fc444f361502eb455fde4cd7cf99706e4df7b7..1db266c32e611ea6f9513fe6b92202100ffd7504 100644 (file)
@@ -1,3 +1,20 @@
+2001-05-23  Theodore Tso  <tytso@valinux.com>
+
+       * journal.c (e2fsck_journal_reset_super): Fix bug; the reset
+               journal wasn't getting written out to disk since the dirty
+               bit wasn't being set on the buffer.
+               (e2fsck_journal_load): Don't print an error message if the
+               journal version number is wrong; just return a error code
+               reflecting this fact.  If the block type in the journal
+               superblcok is obviously not a version number, report the
+               journal is corrupted.
+               (e2fsck_check_ext3_journal): On an unsupported journal
+               version, prompt to abort by default, but then offer a
+               chance to clear the journal as corrupt.
+
+       * problem.c, problem.h (PR_0_JOURNAL_UNSUPP_VERSION): Added new
+               problem code.
+
 2001-05-14  Theodore Tso  <tytso@valinux.com>
 
        * pass1.c: Treat inodes with a low dtime (that were from a
index f5366bb2483c4ae76098ae92d073b3d48d86779b..7bd7862b7857fa9d5adf73edee70e3fa0616c2d7 100644 (file)
@@ -333,15 +333,21 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
        case JFS_SUPERBLOCK_V2:
                journal->j_format_version = 2;
                break;
+
+       /*
+        * These should never appear in a journal super block, so if
+        * they do, the journal is badly corrupted.
+        */
+       case JFS_DESCRIPTOR_BLOCK:
+       case JFS_COMMIT_BLOCK:
+       case JFS_REVOKE_BLOCK:
+               return EXT2_ET_CORRUPT_SUPERBLOCK;
                
        /* If we don't understand the superblock major type, but there
         * is a magic number, then it is likely to be a new format we
         * just don't understand, so leave it alone. */
        default:
-               com_err(ctx->program_name, EXT2_ET_UNSUPP_FEATURE,
-                       _("%s: journal has unrecognised format\n"),
-                       ctx->device_name);
-               return EXT2_ET_UNSUPP_FEATURE;
+               return EXT2_ET_JOURNAL_UNSUPP_VERSION;
        }
 
        if (JFS_HAS_INCOMPAT_FEATURE(journal, ~JFS_KNOWN_INCOMPAT_FEATURES)) {
@@ -427,6 +433,7 @@ static void e2fsck_journal_reset_super(e2fsck_t ctx, journal_superblock_t *jsb,
                new_seq ^= u.val[i];
        jsb->s_sequence = htonl(new_seq);
 
+       mark_buffer_dirty(journal->j_sb_buffer, 1);
        ll_rw_block(WRITE, 1, &journal->j_sb_buffer);
 }
 
@@ -508,7 +515,9 @@ int e2fsck_check_ext3_journal(e2fsck_t ctx)
 
        retval = e2fsck_journal_load(journal);
        if (retval) {
-               if (retval == EXT2_ET_CORRUPT_SUPERBLOCK)
+               if ((retval == EXT2_ET_CORRUPT_SUPERBLOCK) ||
+                   ((retval == EXT2_ET_JOURNAL_UNSUPP_VERSION) &&
+                   (!fix_problem(ctx, PR_0_JOURNAL_UNSUPP_VERSION, &pctx))))
                        retval = e2fsck_journal_fix_corrupt_super(ctx, journal,
                                                                  &pctx);
                e2fsck_journal_release(ctx, journal, 0, 1);
index 947c99802d53152a961b6b94cc1d1d9845ed9007..8c1236050e140f6e8f4242fd05e9e0226047d396 100644 (file)
@@ -276,6 +276,11 @@ static const struct e2fsck_problem problem_table[] = {
        { PR_0_JOURNAL_RESET_COMPAT,
          N_("Ext3 @j @S has bad feature flag(s) set.\n"),
          PROMPT_CLEAR, PR_PREEN_OK|PR_PREEN_NOMSG },
+
+       /* 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 */
        
index f92745d71db8f45faad9c6dcc5676ece3816d23b..180631467acb8ba55eea867e684732635a819e1f 100644 (file)
@@ -155,6 +155,9 @@ struct problem_context {
 /* Journal has unsupported feature - reset */
 #define PR_0_JOURNAL_RESET_COMPAT              0x000027
 
+/* Journal has unsupported version number */
+#define PR_0_JOURNAL_UNSUPP_VERSION            0x000028
+
 /*
  * Pass 1 errors
  */