Re: [PATCH 2/4] jbd2/log_wait_for_space: drop checkpoint mutex when waiting

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

 



On Mon, Jun 10, 2013 at 10:33 PM, Theodore Ts'o <tytso@xxxxxxx> wrote:
> On Mon, Jun 10, 2013 at 03:32:01PM -0400, Paul Gortmaker wrote:
>>
>> What is interesting here, is that we call log_wait_commit, from
>> within wait_for_space, but we are still holding the checkpoint_mutex
>> as it surrounds mostly the whole of wait_for_space.  And then, as we
>> are waiting, journal_commit_transaction can run, and if the JBD2_FLUSHED
>> bit is set, then we will also try to take the same checkpoint_mutex.
>
>>                       } else if (tid) {
>> +                             /*
>> +                              * jbd2_journal_commit_transaction() may want
>> +                              * to take the checkpoint_mutex if JBD2_FLUSHED
>> +                              * is set.  So we need to temporarily drop it.
>> +                              */
>> +                             mutex_unlock(&journal->j_checkpoint_mutex);
>>                               jbd2_log_wait_commit(journal, tid);
>> +                             mutex_lock(&journal->j_checkpoint_mutex);
>>                       } else {
>>                               printk(KERN_ERR "%s: needed %d blocks and "
>>                                      "only had %d space available\n",
>
> After we execute the code in the else cause, we drop through to just
> before the bottom of the while loop, where we see:
>
>                 mutex_unlock(&journal->j_checkpoint_mutex);
>         }
>
> So it would be better to change things like this instead, so we don't
> end up grabbing and releasing the j_checkpoint_mutex unnecessarily:
>
>                         } else if (tid) {
> +                               /*
> +                                * jbd2_journal_commit_transaction() may want
> +                                * to take the checkpoint_mutex if JBD2_FLUSHED
> +                                * is set.  So we need to temporarily drop it.
> +                                */
> +                               mutex_unlock(&journal->j_checkpoint_mutex);
>                                 jbd2_log_wait_commit(journal, tid);
> +                               write_lock(&journal->j_state_lock);
> +                               continue;
>                         } else {
>                                 printk(KERN_ERR "%s: needed %d blocks and "
>                                        "only had %d space available\n",
>
> Could you try respinning the patch like this and testing the result?

Absolutely; will do that tomorrow and re-test on 3.10-rc5.

And I'll keep it in my preempt-rt testing queue too, as I keep
looking into that RT problem.

Thanks for reviewing and confirming it could be a real problem.

Paul.
--

>
> Thanks,
>
>                                                 - Ted
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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