[snip]
When I read the source code again, I noticed the race condition described
in 6 doesn't happen. I've thought journal_flush() can invoke
log_do_checkpoint() while __log_wait_for_space() is invoking
log_do_checkpoint(), but it would be wrong.
First journal_flush() invokes __log_start_commit() and log_wait_commit()
pair. After this, there is no running transaction and no starting handle.
New handles are also not created because j_barrier_count blocks it.
Thus, when journal_flush() invokes log_do_checkpoint(), there is
no other process which invokes __log_wait_for_space() and
log_do_checkpoint() to get free log space. So invocations of
log_do_checkpoint() are always isolated, the race condition doesn't
happen.
If my understanding is correct, adding mutex_lock() around
log_do_checkpoint() (see bellow) is unneeded.
What do you think about this?
[snip]
Best regards,
--
Hidehiro Kawai
Hitachi, Systems Development Laboratory
Linux Technology Center
--