All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] jbd2: Fix assertion failure in jbd2_journal_flush()
Date: Fri, 21 Dec 2012 00:16:39 -0500	[thread overview]
Message-ID: <20121221051639.GA16958@thunk.org> (raw)
In-Reply-To: <1355325462-26757-1-git-send-email-jack@suse.cz>

On Wed, Dec 12, 2012 at 04:17:42PM +0100, Jan Kara wrote:
> The following race is possible between start_this_handle() and someone
> calling jbd2_journal_flush().
> 
> Process A                              Process B
> start_this_handle().
>   if (journal->j_barrier_count) # false
>   if (!journal->j_running_transaction) { #true
>     read_unlock(&journal->j_state_lock);
>                                        jbd2_journal_lock_updates()
>                                        jbd2_journal_flush()
>                                          write_lock(&journal->j_state_lock);
>                                          if (journal->j_running_transaction) {
>                                            # false
>                                          ... wait for committing trans ...
>                                          write_unlock(&journal->j_state_lock);
>     ...
>     write_lock(&journal->j_state_lock);
>     if (!journal->j_running_transaction) { # true
>       jbd2_get_transaction(journal, new_transaction);
>     write_unlock(&journal->j_state_lock);
>     goto repeat; # eventually blocks on j_barrier_count > 0
>                                          ...
>                                          J_ASSERT(!journal->j_running_transaction);
>                                            # fails
> 
> We fix the race by rechecking j_barrier_count after reacquiring j_state_lock
> in exclusive mode.
> 
> CC: stable@vger.kernel.org
> Reported-by:yjwsignal@empal.com
> Signed-off-by: Jan Kara <jack@suse.cz>

Thanks, applied.

						- Ted

      reply	other threads:[~2012-12-21  5:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 15:17 [PATCH] jbd2: Fix assertion failure in jbd2_journal_flush() Jan Kara
2012-12-21  5:16 ` Theodore 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=20121221051639.GA16958@thunk.org \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.