On Tue, Jun 09, 2020 at 01:50:26PM +0200, Jan Kara wrote: > On Tue 09-06-20 15:35:40, zhangyi (F) wrote: > > 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@xxxxxxxxxx> > > Cc: <stable@xxxxxxxxxxxxxxx> > > Great, thanks! The patch looks good to me. You can add: > > Reviewed-by: Jan Kara <jack@xxxxxxx> Applied, thanks. - Ted