Skip to content

Commit f57886c

Browse files
Ye Bintytso
authored andcommitted
ext4: make sure fs error flag setted before clear journal error
Now, jounral error number maybe cleared even though ext4_commit_super() failed. This may lead to error flag miss, then fsck will miss to check file system deeply. Signed-off-by: Ye Bin <yebin10@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230307061703.245965-3-yebin@huaweicloud.com
1 parent eee0023 commit f57886c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ext4/super.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6205,11 +6205,13 @@ static int ext4_clear_journal_err(struct super_block *sb,
62056205
errstr = ext4_decode_error(sb, j_errno, nbuf);
62066206
ext4_warning(sb, "Filesystem error recorded "
62076207
"from previous mount: %s", errstr);
6208-
ext4_warning(sb, "Marking fs in need of filesystem check.");
62096208

62106209
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
62116210
es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
6212-
ext4_commit_super(sb);
6211+
j_errno = ext4_commit_super(sb);
6212+
if (j_errno)
6213+
return j_errno;
6214+
ext4_warning(sb, "Marked fs in need of filesystem check.");
62136215

62146216
jbd2_journal_clear_err(journal);
62156217
jbd2_journal_update_sb_errno(journal);

0 commit comments

Comments
 (0)