Skip to content

Commit

Permalink
librbd: avoid dereferencing an empty container during deep-copy
Browse files Browse the repository at this point in the history
While updating the image copy progress, a 'while' loop will pop the
last item from the queue and then deference the empty queue.

Fixes: http://tracker.ceph.com/issues/40368
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 0f491cb)
  • Loading branch information
Jason Dillaman committed Jun 15, 2019
1 parent 100196f commit c937551
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librbd/deep_copy/ImageCopyRequest.cc
Expand Up @@ -143,8 +143,9 @@ void ImageCopyRequest<I>::handle_object_copy(uint64_t object_no, int r) {
}
} else {
m_copied_objects.push(object_no);
while (!m_updating_progress && m_copied_objects.top() ==
(m_object_number ? *m_object_number + 1 : 0)) {
while (!m_updating_progress && !m_copied_objects.empty() &&
m_copied_objects.top() ==
(m_object_number ? *m_object_number + 1 : 0)) {
m_object_number = m_copied_objects.top();
m_copied_objects.pop();
uint64_t progress_object_no = *m_object_number + 1;
Expand Down

0 comments on commit c937551

Please sign in to comment.