diff options
author | Dan Mick <dan.mick@inktank.com> | 2012-12-03 20:59:17 -0800 |
---|---|---|
committer | Dan Mick <dan.mick@inktank.com> | 2012-12-05 17:05:18 -0800 |
commit | a55700cc0aea0ff79e55c6bf78e9757b81fe9425 (patch) | |
tree | f30fad567ce03da81f91dc32cf04764bfabbed2b | |
parent | 41e16a3b40efb80a5ed7a5587438569ca86c85a3 (diff) | |
download | ceph-a55700cc0aea0ff79e55c6bf78e9757b81fe9425.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>
-rw-r--r-- | src/librbd/AioCompletion.cc | 9 |
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); |