From e9653f27de614c37a7f56c6f9e44871baf0603e4 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Mon, 3 Dec 2012 20:59:17 -0800 Subject: [PATCH] librbd: hold AioCompletion lock while modifying global state C_AioRead::finish needs to add in each chunk of a partial read request to the 'partial' map in the AioCompletion's state (in destriper, of type StripedReadResult). That map is global and must be protected from simultaneous access. Use the AioCompletion lock; could create a separate lock if contention is an issue. Fixes: #3567 Signed-off-by: Dan Mick (cherry picked from commit a55700cc0aea0ff79e55c6bf78e9757b81fe9425) --- src/librbd/AioCompletion.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librbd/AioCompletion.cc b/src/librbd/AioCompletion.cc index 082a08eb651..86b5b504ebd 100644 --- a/src/librbd/AioCompletion.cc +++ b/src/librbd/AioCompletion.cc @@ -88,10 +88,11 @@ namespace librbd { if (m_req->m_ext_map.empty()) m_req->m_ext_map[m_req->m_object_off] = m_req->data().length(); - m_completion->destriper.add_partial_sparse_result(m_cct, - m_req->data(), - m_req->m_ext_map, m_req->m_object_off, - m_req->m_buffer_extents); + m_completion->lock.Lock(); + m_completion->destriper.add_partial_sparse_result( + m_cct, m_req->data(), m_req->m_ext_map, m_req->m_object_off, + m_req->m_buffer_extents); + m_completion->lock.Unlock(); r = m_req->m_object_len; } m_completion->complete_request(m_cct, r);