From b92ae1535c7bba947100819d8efbad05b41c17f0 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 2 Jan 2003 16:53:54 -0500 Subject: [PATCH] Detect if there is an attempt to run the journal twice, and abort the e2fsck run with an error if this is the case. (Address IBM Bugzilla bug #1226) --- e2fsck/ChangeLog | 6 ++++++ e2fsck/e2fsck.h | 1 + e2fsck/unix.c | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 86c74cb..c2ba5c3 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2003-01-02 Theodore Ts'o + + * 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 * unix.c (PRS): Print an error if more than one of the -p/-a, -n diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 492a231..c535d04 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -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 diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 819352c..d98112b 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -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; } } -- 1.8.3.1