From 3112a93b49c24f9ae101a7f252c8e708e0d3e260 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 22 Jun 2016 18:09:29 -0400 Subject: [PATCH] librbd: journal::Replay no longer holds lock while completing callback Fixes: http://tracker.ceph.com/issues/16433 Signed-off-by: Jason Dillaman --- src/librbd/journal/Replay.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/librbd/journal/Replay.cc b/src/librbd/journal/Replay.cc index 2de4de9c7f140..a5dfc907263b9 100644 --- a/src/librbd/journal/Replay.cc +++ b/src/librbd/journal/Replay.cc @@ -805,12 +805,18 @@ void Replay::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); } } -- 2.39.5