mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
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 <yebin10@huawei.com> Reviewed-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230307061703.245965-2-yebin@huaweicloud.com
This commit is contained in:
parent
62913ae96d
commit
eee00237fa
@ -5959,6 +5959,7 @@ static int ext4_load_journal(struct super_block *sb,
|
|||||||
err = jbd2_journal_wipe(journal, !really_read_only);
|
err = jbd2_journal_wipe(journal, !really_read_only);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL);
|
char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL);
|
||||||
|
|
||||||
if (save)
|
if (save)
|
||||||
memcpy(save, ((char *) es) +
|
memcpy(save, ((char *) es) +
|
||||||
EXT4_S_ERR_START, EXT4_S_ERR_LEN);
|
EXT4_S_ERR_START, EXT4_S_ERR_LEN);
|
||||||
@ -5967,6 +5968,14 @@ static int ext4_load_journal(struct super_block *sb,
|
|||||||
memcpy(((char *) es) + EXT4_S_ERR_START,
|
memcpy(((char *) es) + EXT4_S_ERR_START,
|
||||||
save, EXT4_S_ERR_LEN);
|
save, EXT4_S_ERR_LEN);
|
||||||
kfree(save);
|
kfree(save);
|
||||||
|
es->s_state |= cpu_to_le16(EXT4_SB(sb)->s_mount_state &
|
||||||
|
EXT4_ERROR_FS);
|
||||||
|
/* Write out restored error information to the superblock */
|
||||||
|
if (!bdev_read_only(sb->s_bdev)) {
|
||||||
|
int err2;
|
||||||
|
err2 = ext4_commit_super(sb);
|
||||||
|
err = err ? : err2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user