diff options
author | zhangyi (F) <yi.zhang@huawei.com> | 2020-06-09 15:35:40 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-06-12 14:51:41 -0400 |
commit | 7b97d868b7ab2448859668de9222b8af43f76e78 (patch) | |
tree | 976e49fc89eb8cd37e653d27192d9cb5289ed884 /block | |
parent | 88ee9d571b6d8ed345f877e05f685814412e359b (diff) | |
download | linux-7b97d868b7ab2448859668de9222b8af43f76e78.tar.bz2 |
ext4, jbd2: ensure panic by fix a race between jbd2 abort and ext4 error handlers
In the ext4 filesystem with errors=panic, if one process is recording
errno in the superblock when invoking jbd2_journal_abort() due to some
error cases, it could be raced by another __ext4_abort() which is
setting the SB_RDONLY flag but missing panic because errno has not been
recorded.
jbd2_journal_commit_transaction()
jbd2_journal_abort()
journal->j_flags |= JBD2_ABORT;
jbd2_journal_update_sb_errno()
| ext4_journal_check_start()
| __ext4_abort()
| sb->s_flags |= SB_RDONLY;
| if (!JBD2_REC_ERR)
| return;
journal->j_flags |= JBD2_REC_ERR;
Finally, it will no longer trigger panic because the filesystem has
already been set read-only. Fix this by introduce j_abort_mutex to make
sure journal abort is completed before panic, and remove JBD2_REC_ERR
flag.
Fixes: 4327ba52afd03 ("ext4, jbd2: ensure entering into panic after recording an error in superblock")
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200609073540.3810702-1-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions