summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2012-12-03 20:59:17 -0800
committerDan Mick <dan.mick@inktank.com>2012-12-05 17:38:05 -0800
commite9653f27de614c37a7f56c6f9e44871baf0603e4 (patch)
treef2236ef8a32777839e8508c256cf68d8ba65a9c6
parentb2ccf11d3a108141f113f3f5640d459205f208f2 (diff)
downloadceph-e9653f27de614c37a7f56c6f9e44871baf0603e4.tar.gz
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 a55700cc0aea0ff79e55c6bf78e9757b81fe9425)
-rw-r--r--src/librbd/AioCompletion.cc9
1 files 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);