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 <dan.mick@inktank.com>
(cherry picked from commit a55700cc0a)
This commit is contained in:
Dan Mick 2012-12-03 20:59:17 -08:00
parent b2ccf11d3a
commit e9653f27de

View File

@ -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);