diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-06-06 17:50:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-06-06 17:50:40 -0400 |
commit | 624080eded68738daee041ad64672a9d2614754f (patch) | |
tree | c1350c70233c1f7536a1927bacabe4084770d3c7 /fs/ext4/super.c | |
parent | 8ea76900be3b4522396e2021260d2818a27b3a5b (diff) |
jbd2: If a journal checksum error is detected, propagate the error to ext4
If a journal checksum error is detected, the ext4 filesystem will call
ext4_error(), and the mount will either continue, become a read-only
mount, or cause a kernel panic based on the superblock flags
indicating the user's preference of what to do in case of filesystem
corruption being detected.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 09d9359c8055..d01a32e8b50a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2189,6 +2189,29 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
2189 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { | 2189 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { |
2190 | if (ext4_load_journal(sb, es, journal_devnum)) | 2190 | if (ext4_load_journal(sb, es, journal_devnum)) |
2191 | goto failed_mount3; | 2191 | goto failed_mount3; |
2192 | if (!(sb->s_flags & MS_RDONLY) && | ||
2193 | EXT4_SB(sb)->s_journal->j_failed_commit) { | ||
2194 | printk(KERN_CRIT "EXT4-fs error (device %s): " | ||
2195 | "ext4_fill_super: Journal transaction " | ||
2196 | "%u is corrupt\n", sb->s_id, | ||
2197 | EXT4_SB(sb)->s_journal->j_failed_commit); | ||
2198 | if (test_opt (sb, ERRORS_RO)) { | ||
2199 | printk (KERN_CRIT | ||
2200 | "Mounting filesystem read-only\n"); | ||
2201 | sb->s_flags |= MS_RDONLY; | ||
2202 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | ||
2203 | es->s_state |= cpu_to_le16(EXT4_ERROR_FS); | ||
2204 | } | ||
2205 | if (test_opt(sb, ERRORS_PANIC)) { | ||
2206 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | ||
2207 | es->s_state |= cpu_to_le16(EXT4_ERROR_FS); | ||
2208 | ext4_commit_super(sb, es, 1); | ||
2209 | printk(KERN_CRIT | ||
2210 | "EXT4-fs (device %s): mount failed\n", | ||
2211 | sb->s_id); | ||
2212 | goto failed_mount4; | ||
2213 | } | ||
2214 | } | ||
2192 | } else if (journal_inum) { | 2215 | } else if (journal_inum) { |
2193 | if (ext4_create_journal(sb, es, journal_inum)) | 2216 | if (ext4_create_journal(sb, es, journal_inum)) |
2194 | goto failed_mount3; | 2217 | goto failed_mount3; |