Skip to content

Commit eee0023

Browse files
Ye Bintytso
authored andcommitted
ext4: commit super block if fs record error when journal record without error
Now, 'es->s_state' maybe covered by recover journal. And journal errno maybe not recorded in journal sb as IO error. ext4_update_super() only update error information when 'sbi->s_add_error_count' large than zero. Then 'EXT4_ERROR_FS' flag maybe lost. To solve above issue just recover 'es->s_state' error flag after journal replay like error info. Signed-off-by: Ye Bin <[email protected]> Reviewed-by: Baokun Li <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 62913ae commit eee0023

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/ext4/super.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5959,6 +5959,7 @@ static int ext4_load_journal(struct super_block *sb,
59595959
err = jbd2_journal_wipe(journal, !really_read_only);
59605960
if (!err) {
59615961
char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL);
5962+
59625963
if (save)
59635964
memcpy(save, ((char *) es) +
59645965
EXT4_S_ERR_START, EXT4_S_ERR_LEN);
@@ -5967,6 +5968,14 @@ static int ext4_load_journal(struct super_block *sb,
59675968
memcpy(((char *) es) + EXT4_S_ERR_START,
59685969
save, EXT4_S_ERR_LEN);
59695970
kfree(save);
5971+
es->s_state |= cpu_to_le16(EXT4_SB(sb)->s_mount_state &
5972+
EXT4_ERROR_FS);
5973+
/* Write out restored error information to the superblock */
5974+
if (!bdev_read_only(sb->s_bdev)) {
5975+
int err2;
5976+
err2 = ext4_commit_super(sb);
5977+
err = err ? : err2;
5978+
}
59705979
}
59715980

59725981
if (err) {

0 commit comments

Comments
 (0)