+2006-03-10 Theodore Ts'o <tytso@mit.edu>
+
+ * e2fsck.h, journal.c (e2fsck_fix_ext3_journal_hint),
+ problem.c (PR_0_EXTERNAL_JOURNAL_HINT),
+ problem.h (PR_0_EXTERNAL_JOURNAL_HINT), super.c: Check
+ to see if the superblock hint for the external journal
+ needs to be updated, and if so, offer to update it.
+ (Addresses Debian Bug: #355644)
+
2006-01-29 Theodore Ts'o <tytso@mit.edu>
* unix.c (check_if_skip): When skipping a check due to being on
extern int e2fsck_check_ext3_journal(e2fsck_t ctx);
extern int e2fsck_run_ext3_journal(e2fsck_t ctx);
extern void e2fsck_move_ext3_journal(e2fsck_t ctx);
+extern int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx);
/* pass1.c */
extern void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int bool);
return;
}
+/*
+ * This function makes sure the superblock hint for the external
+ * journal is correct.
+ */
+int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx)
+{
+ struct ext2_super_block *sb = ctx->fs->super;
+ struct problem_context pctx;
+ char uuid[37], *journal_name;
+ struct stat st;
+ problem_t problem;
+ int retval;
+
+ if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) ||
+ uuid_is_null(sb->s_journal_uuid))
+ return 0;
+
+ uuid_unparse(sb->s_journal_uuid, uuid);
+ journal_name = blkid_get_devname(ctx->blkid, "UUID", uuid);
+ if (!journal_name)
+ return 0;
+
+ if (stat(journal_name, &st) < 0)
+ return 0;
+
+ if (st.st_rdev != sb->s_journal_dev) {
+ clear_problem_context(&pctx);
+ pctx.num = st.st_rdev;
+ if (fix_problem(ctx, PR_0_EXTERNAL_JOURNAL_HINT, &pctx)) {
+ sb->s_journal_dev = st.st_rdev;
+ ext2fs_mark_super_dirty(ctx->fs);
+ }
+ }
+
+ free(journal_name);
+ return 0;
+}
N_("@S last write time is in the future. "),
PROMPT_FIX, PR_PREEN_OK },
+ { PR_0_EXTERNAL_JOURNAL_HINT,
+ N_("@S hint for external superblock @s %X. "),
+ PROMPT_FIX, PR_PREEN_OK },
+
/* Pass 1 errors */
/* Pass 1: Checking inodes, blocks, and sizes */
/* Last write time is in the future */
#define PR_0_FUTURE_SB_LAST_WRITE 0x000032
+/* Superblock hint for external journal incorrect */
+#define PR_0_EXTERNAL_JOURNAL_HINT 0x000033
+
/*
* Pass 1 errors
*/
* Move the ext3 journal file, if necessary.
*/
e2fsck_move_ext3_journal(ctx);
+
+ /*
+ * Fix journal hint, if necessary
+ */
+ e2fsck_fix_ext3_journal_hint(ctx);
+
return;
}