From: Baokun Li <libaokun1@huawei.com>
To: Ye Bin <yebin@huaweicloud.com>, <tytso@mit.edu>,
<adilger.kernel@dilger.ca>, <linux-ext4@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <jack@suse.cz>,
Ye Bin <yebin10@huawei.com>
Subject: Re: [PATCH v5 1/2] ext4: commit super block if fs record error when journal record without error
Date: Wed, 8 Mar 2023 09:04:18 +0800 [thread overview]
Message-ID: <0f0ac9eb-1432-a61f-717f-88bd3d6fa7fc@huawei.com> (raw)
In-Reply-To: <20230307061703.245965-2-yebin@huaweicloud.com>
On 2023/3/7 14:17, Ye Bin wrote:
> From: Ye Bin <yebin10@huawei.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@huawei.com>
Looks good to me.
Reviewed-by: Baokun Li <libaokun1@huawei.com>
> ---
> fs/ext4/super.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 88f7b8a88c76..dfa31eea1346 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5920,6 +5920,7 @@ static int ext4_load_journal(struct super_block *sb,
> err = jbd2_journal_wipe(journal, !really_read_only);
> if (!err) {
> char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL);
> +
> if (save)
> memcpy(save, ((char *) es) +
> EXT4_S_ERR_START, EXT4_S_ERR_LEN);
> @@ -5928,6 +5929,14 @@ 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 */
> + if (!bdev_read_only(sb->s_bdev)) {
> + int err2;
> + err2 = ext4_commit_super(sb);
> + err = err ? : err2;
> + }
> }
>
> if (err) {
--
With Best Regards,
Baokun Li
.
next prev parent reply other threads:[~2023-03-08 1:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 6:17 [PATCH v5 0/2] fix error flag covered by journal recovery Ye Bin
2023-03-07 6:17 ` [PATCH v5 1/2] ext4: commit super block if fs record error when journal record without error Ye Bin
2023-03-07 9:02 ` Jan Kara
2023-03-08 1:04 ` Baokun Li [this message]
2023-03-07 6:17 ` [PATCH v5 2/2] ext4: make sure fs error flag setted before clear journal error Ye Bin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0f0ac9eb-1432-a61f-717f-88bd3d6fa7fc@huawei.com \
--to=libaokun1@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yebin10@huawei.com \
--cc=yebin@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).