[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7d83b111-3fd0-f410-6904-17c830496621@huawei.com>
Date: Thu, 2 Mar 2023 09:30:06 +0800
From: Baokun Li <libaokun1@...wei.com>
To: Ye Bin <yebin@...weicloud.com>, <tytso@....edu>,
<adilger.kernel@...ger.ca>, <linux-ext4@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <jack@...e.cz>,
Ye Bin <yebin10@...wei.com>
Subject: Re: [PATCH v4 1/2] ext4: commit super block if fs record error when
journal record without error
On 2023/3/1 19:59, Ye Bin wrote:
> From: Ye Bin <yebin10@...wei.com>
>
> 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@...wei.com>
Looks good to me.
Reviewed-by: Baokun Li <libaokun1@...wei.com>
> ---
> fs/ext4/super.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index faae05493471..9df8fada2dce 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5910,7 +5910,9 @@ static int ext4_load_journal(struct super_block *sb,
> if (!ext4_has_feature_journal_needs_recovery(sb))
> err = jbd2_journal_wipe(journal, !really_read_only);
> if (!err) {
> + int err2;
> char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL);
> +
> if (save)
> memcpy(save, ((char *) es) +
> EXT4_S_ERR_START, EXT4_S_ERR_LEN);
> @@ -5919,6 +5921,11 @@ static int ext4_load_journal(struct super_block *sb,
> memcpy(((char *) es) + EXT4_S_ERR_START,
> save, EXT4_S_ERR_LEN);
> 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 */
> + err2 = ext4_commit_super(sb);
> + err = err ? : err2;
> }
>
> if (err) {
--
With Best Regards,
Baokun Li
.
Powered by blists - more mailing lists