Re: [MC] [CHECKER] e2fsck writes out blocks out of order, causingroot dir to be corrupted (ext3, linux 2.4.19, e2fsprogs 1.34)

From: Junfeng Yang
Date: Tue May 11 2004 - 20:57:08 EST



Although the kernel and e2fsck share the same copy of recovery.c, the same
problem doesn't seem to exist to the kernel, since fsync_no_super will do
the sync for the kernel. While for e2fsck, fsync_no_super is defined as a
nop.

int journal_recover(journal_t *journal)
{
int err;
journal_superblock_t * sb;

struct recovery_info info;

memset(&info, 0, sizeof(info));
sb = journal->j_superblock;

/*
* The journal superblock's s_start field (the current log head)
* is always zero if, and only if, the journal was cleanly
* unmounted.
*/

if (!sb->s_start) {
jbd_debug(1, "No recovery required, last transaction
%d\n",
ntohl(sb->s_sequence));
journal->j_transaction_sequence = ntohl(sb->s_sequence) +
1;
return 0;
}


err = do_one_pass(journal, &info, PASS_SCAN);
if (!err)
err = do_one_pass(journal, &info, PASS_REVOKE);
if (!err)
err = do_one_pass(journal, &info, PASS_REPLAY);

jbd_debug(0, "JBD: recovery, exit status %d, "
"recovered transactions %u to %u\n",
err, info.start_transaction, info.end_transaction);
jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n",
info.nr_replays, info.nr_revoke_hits, info.nr_revokes);

/* Restart the log at the next transaction ID, thus invalidating
* any existing commit records in the log. */
journal->j_transaction_sequence = ++info.end_transaction;

journal_clear_revoke(journal);
fsync_no_super(journal->j_fs_dev);
return err;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/