Re: [PATCH] jbd2: Fix assertion failure in jbd2_journal_flush()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
> Reported-by:yjwsignal@xxxxxxxxx
> Signed-off-by: Jan Kara <jack@xxxxxxx>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux