linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: "zhangyi (F)" <yi.zhang@huawei.com>,
	linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca,
	zhangxiaoxu5@huawei.com
Subject: Re: [PATCH v2] ext4, jbd2: ensure panic by fix a race between jbd2 abort and ext4 error handlers
Date: Fri, 12 Jun 2020 14:52:07 -0400	[thread overview]
Message-ID: <20200612185207.GB2863913@mit.edu> (raw)
In-Reply-To: <20200609115026.GA12551@quack2.suse.cz>

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@huawei.com>
> > Cc: <stable@vger.kernel.org>
> 
> Great, thanks! The patch looks good to me. You can add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Applied, thanks.

						- Ted

      reply	other threads:[~2020-06-12 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09  7:35 [PATCH v2] ext4, jbd2: ensure panic by fix a race between jbd2 abort and ext4 error handlers zhangyi (F)
2020-06-09 11:50 ` Jan Kara
2020-06-12 18:52   ` Theodore Y. Ts'o [this message]

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=20200612185207.GB2863913@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=yi.zhang@huawei.com \
    --cc=zhangxiaoxu5@huawei.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).