Merge pull request #9881 from dillaman/wip-16433

librbd: journal::Replay no longer holds lock while completing callback

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
This commit is contained in:
Mykola Golub 2016-06-23 20:25:38 +03:00 committed by GitHub
commit c763018adf

View File

@ -805,12 +805,18 @@ void Replay<I>::handle_op_complete(uint64_t op_tid, int r) {
// shut down request might have occurred while lock was
// dropped -- handle if pending
Mutex::Locker locker(m_lock);
assert(m_in_flight_op_events > 0);
--m_in_flight_op_events;
if (m_flush_ctx != nullptr && m_in_flight_op_events == 0 &&
(m_in_flight_aio_flush + m_in_flight_aio_modify) == 0) {
m_image_ctx.op_work_queue->queue(m_flush_ctx, 0);
Context *on_flush = nullptr;
{
Mutex::Locker locker(m_lock);
assert(m_in_flight_op_events > 0);
--m_in_flight_op_events;
if (m_in_flight_op_events == 0 &&
(m_in_flight_aio_flush + m_in_flight_aio_modify) == 0) {
on_flush = m_flush_ctx;
}
}
if (on_flush != nullptr) {
m_image_ctx.op_work_queue->queue(on_flush, 0);
}
}