Whamcloud - gitweb
Detect if there is an attempt to run the journal twice, and
authorTheodore Ts'o <tytso@mit.edu>
Thu, 2 Jan 2003 21:53:54 +0000 (16:53 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 2 Jan 2003 21:53:54 +0000 (16:53 -0500)
abort the e2fsck run with an error if this is the case.
(Address IBM Bugzilla bug #1226)

e2fsck/ChangeLog
e2fsck/e2fsck.h
e2fsck/unix.c

index 86c74cb..c2ba5c3 100644 (file)
@@ -1,3 +1,9 @@
+2003-01-02  Theodore Ts'o  <tytso@mit.edu>
+
+       * unix.c (main): Detect if there is an attempt to run the journal
+               twice, and abort with an error if this is the case.
+               (Address IBM Bugzilla bug #1226)
+
 2003-11-19  Theodore Ts'o  <tytso@mit.edu>
 
        * unix.c (PRS): Print an error if more than one of the -p/-a, -n
index 492a231..c535d04 100644 (file)
@@ -156,6 +156,7 @@ struct resource_track {
 #define E2F_FLAG_JOURNAL_INODE 0x0080 /* Create a new ext3 journal inode */
 #define E2F_FLAG_SB_SPECIFIED  0x0100 /* The superblock was explicitly 
                                        * specified by the user */
+#define E2F_FLAG_RESTARTED     0x0100 /* E2fsck has been restarted */
 
 /*
  * Defines for indicating the e2fsck pass number
index 819352c..d98112b 100644 (file)
@@ -933,6 +933,17 @@ restart:
                                 "check.\n"));
                        io_channel_flush(ctx->fs->io);
                } else {
+                       if (ctx->flags & E2F_FLAG_RESTARTED) {
+                               /*
+                                * Whoops, we attempted to run the
+                                * journal twice.  This should never
+                                * happen, unless the hardware or
+                                * device driver is being bogus.
+                                */
+                               com_err(ctx->program_name, 0,
+                                       _("unable to set superblock flags on %s\n"), ctx->device_name);
+                               fatal_error(ctx, 0);
+                       }
                        retval = e2fsck_run_ext3_journal(ctx);
                        if (retval) {
                                com_err(ctx->program_name, retval,
@@ -942,6 +953,7 @@ restart:
                        }
                        ext2fs_close(ctx->fs);
                        ctx->fs = 0;
+                       ctx->flags |= E2F_FLAG_RESTARTED;
                        goto restart;
                }
        }