Skip to content

Commit

Permalink
librbd: release lock executing deep copy progress callback
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/23929
Signed-off-by: Mykola Golub <mgolub@suse.com>
  • Loading branch information
trociny committed Apr 30, 2018
1 parent 625c689 commit 93b9eb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/librbd/deep_copy/ImageCopyRequest.cc
Expand Up @@ -86,7 +86,7 @@ void ImageCopyRequest<I>::send_object_copies() {
break;
}
}
complete = (m_current_ops == 0);
complete = (m_current_ops == 0) && !m_updating_progress;
}

if (complete) {
Expand Down Expand Up @@ -139,16 +139,22 @@ void ImageCopyRequest<I>::handle_object_copy(uint64_t object_no, int r) {
}
} else {
m_copied_objects.push(object_no);
while (m_copied_objects.top() ==
while (!m_updating_progress && m_copied_objects.top() ==
(m_object_number ? *m_object_number + 1 : 0)) {
m_object_number = m_copied_objects.top();
m_copied_objects.pop();
m_prog_ctx->update_progress(*m_object_number + 1, m_end_object_no);
uint64_t progress_object_no = *m_object_number + 1;
m_updating_progress = true;
m_lock.Unlock();
m_prog_ctx->update_progress(progress_object_no, m_end_object_no);
m_lock.Lock();
assert(m_updating_progress);
m_updating_progress = false;
}
}

send_next_object_copy();
complete = (m_current_ops == 0);
complete = (m_current_ops == 0) && !m_updating_progress;
}

if (complete) {
Expand Down
1 change: 1 addition & 0 deletions src/librbd/deep_copy/ImageCopyRequest.h
Expand Up @@ -82,6 +82,7 @@ class ImageCopyRequest : public RefCountedObject {
uint64_t m_current_ops = 0;
std::priority_queue<
uint64_t, std::vector<uint64_t>, std::greater<uint64_t>> m_copied_objects;
bool m_updating_progress = false;
SnapMap m_snap_map;
int m_ret_val = 0;

Expand Down

0 comments on commit 93b9eb7

Please sign in to comment.