summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorYe Bin <yebin10@huawei.com>2023-03-07 14:17:03 +0800
committerTheodore Ts'o <tytso@mit.edu>2023-03-11 00:44:24 -0500
commitf57886ca1606ba74cc4ec4eb5cbf073934ffa559 (patch)
tree7cd3d1dd01579dc114a009b256e7fd8733eb9977 /fs
parenteee00237fa5ec8f704f7323b54e48cc34e2d9168 (diff)
downloadlinux-stable-f57886ca1606ba74cc4ec4eb5cbf073934ffa559.tar.gz
linux-stable-f57886ca1606ba74cc4ec4eb5cbf073934ffa559.tar.bz2
linux-stable-f57886ca1606ba74cc4ec4eb5cbf073934ffa559.zip
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
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/super.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index effe5e5bab71..a7495f4ef3e1 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -6205,11 +6205,13 @@ static int ext4_clear_journal_err(struct super_block *sb,
errstr = ext4_decode_error(sb, j_errno, nbuf);
ext4_warning(sb, "Filesystem error recorded "
"from previous mount: %s", errstr);
- ext4_warning(sb, "Marking fs in need of filesystem check.");
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
- ext4_commit_super(sb);
+ j_errno = ext4_commit_super(sb);
+ if (j_errno)
+ return j_errno;
+ ext4_warning(sb, "Marked fs in need of filesystem check.");
jbd2_journal_clear_err(journal);
jbd2_journal_update_sb_errno(journal);