ChangeLog, pass1.c, problem.c, problem.h:
pass1.c (e2fsck_pass1): Moved journal inode handling out to its own
block; if the journal inode is not in use, and it contains data, offer
to clear it.
problem.h, problem.c (PR1_JOURNAL_INODE_NOT_CLEAR): Add new problem
code.
problem.c: Modified problem table to use a new abbreviations.
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 2b4b7c5..58a0838 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,14 @@
2001-01-03 <tytso@snap.thunk.org>
+ * pass1.c (e2fsck_pass1): Moved journal inode handling out to its
+ own block; if the journal inode is not in use, and it
+ contains data, offer to clear it.
+
+ * problem.h, problem.c (PR1_JOURNAL_INODE_NOT_CLEAR): Add new
+ problem code.
+
+ * problem.c: Modified problem table to use a new abbreviations.
+
* message.c: Add @j abbreviation for journal, and @d abbreviation
for device.
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 098988c..d09c064 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -392,6 +392,19 @@
}
}
}
+ if (ino == EXT2_JOURNAL_INO) {
+ ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
+ if (fs->super->s_journal_inum == EXT2_JOURNAL_INO) {
+ check_blocks(ctx, &pctx, block_buf);
+ goto next;
+ }
+ if ((inode.i_blocks || inode.i_block[0]) &&
+ fix_problem(ctx, PR1_JOURNAL_INODE_NOT_CLEAR,
+ &pctx)) {
+ memset(&inode, 0, sizeof(inode));
+ e2fsck_write_inode(ctx, ino, &inode, "pass1");
+ }
+ }
if ((ino != EXT2_ROOT_INO) &&
(ino < EXT2_FIRST_INODE(fs->super))) {
int problem = 0;
@@ -402,10 +415,6 @@
if (LINUX_S_ISDIR(inode.i_mode))
problem = PR_1_RESERVED_BAD_MODE;
break;
- case EXT2_JOURNAL_INO:
- if (fs->super->s_journal_inum ==
- EXT2_JOURNAL_INO)
- break;
default:
if (inode.i_mode != 0)
problem = PR_1_RESERVED_BAD_MODE;
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 5597052..9eafd06 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -110,16 +110,16 @@
/* 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 @d 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"),
+ " e2fsck -b %S <@d>\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 @d is %c @bs\n"
"Either the @S or the partition table is likely to be corrupt!\n"),
PROMPT_ABORT, 0 },
@@ -162,7 +162,7 @@
/* 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 @d: %m\n"),
PROMPT_NONE, PR_FATAL },
/* Inode count in superblock is incorrect */
@@ -176,52 +176,52 @@
/* 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 %N).\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"),
+ N_("@S has external ext3 @j @d (unsupported).\n"),
PROMPT_ABORT, PR_NO_OK | PR_AFTER_CODE, PR_0_JOURNAL_BAD_DEV },
/* Superblock has a bad journal device */
{ PR_0_JOURNAL_BAD_DEV,
- N_("@S has a bad ext3 journal (device %X).\n"),
+ N_("@S has a bad ext3 @j (@d %X).\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* 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"),
+ N_("@S has an ext3 @j UUID (unsupported).\n"),
PROMPT_ABORT, PR_NO_OK | PR_AFTER_CODE, PR_0_JOURNAL_BAD_UUID },
/* Superblock has a bad journal UUID */
{ PR_0_JOURNAL_BAD_UUID,
- N_("@S has a bad ext3 journal (UUID %s).\n"),
+ N_("@S has a bad ext3 @j (UUID %s).\n"),
PROMPT_CLEAR, PR_PREEN_OK },
/* 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"),
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"),
+ N_("@S doesn't have has_journal flag, but has ext3 @j %s.\n"),
PROMPT_DELETE, 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 */
@@ -480,13 +480,13 @@
/* 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) */
@@ -509,7 +509,7 @@
/* Immutable flag set on a device or socket inode */
{ PR_1_SET_IMMUTABLE,
- N_("Special (device/socket/fifo) @i %i has immutable or "
+ N_("Special (@d/socket/fifo) @i %i has immutable or "
"append-only flag set.\n"),
PROMPT_CLEAR, PR_PREEN_OK | PR_PREEN_NO | PR_NO_OK },
@@ -520,14 +520,19 @@
/* Non-zero size for device, fifo or socket inode */
{ PR_1_SET_NONZSIZE,
- "Special (device/socket/fifo) @i %i has non-zero size. ",
+ "Special (@d/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. ",
+ "@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 */
+ { PR1_JOURNAL_INODE_NOT_CLEAR,
+ "@j @i is not in use, but contains data. ",
+ PROMPT_CLEAR, PR_PREEN_OK },
+
/* Pass 1b errors */
/* Pass 1B: Rescan for duplicate/bad blocks */
@@ -739,12 +744,12 @@
/* 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 @d.\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 @d.\n"),
PROMPT_CLEAR, 0 },
/* Duplicate '.' entry */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 0ea3298..424f645 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -305,6 +305,9 @@
/* Filesystem revision is 0, but feature flags are set */
#define PR_1_FS_REV_LEVEL 0x010033
+/* Journal inode not in use, needs clearing */
+#define PR1_JOURNAL_INODE_NOT_CLEAR 0x010034
+
/*
* Pass 1b errors
*/