]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: gracefully fail if object map is unavailable
authorJason Dillaman <dillaman@redhat.com>
Thu, 30 Jun 2016 14:24:01 +0000 (10:24 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 30 Jun 2016 14:24:01 +0000 (10:24 -0400)
If the exclusive lock was lost due to a watch failure from an
overloaded cluster, gracefully abort the image sync.

Fixes: http://tracker.ceph.com/issues/16558
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_sync/ObjectCopyRequest.cc

index 89acd037a6c764ec2c0e3659e9b5dc97b0a4afd8..9975b5bf8157672f45941d475c93f4ba3396106f 100644 (file)
@@ -235,6 +235,13 @@ void ObjectCopyRequest<I>::send_update_object_map() {
     m_local_image_ctx->snap_lock.put_read();
     finish(0);
     return;
+  } else if (m_local_image_ctx->object_map == nullptr) {
+    // possible that exclusive lock was lost in background
+    derr << ": object map is not initialized" << dendl;
+
+    m_local_image_ctx->snap_lock.put_read();
+    finish(-EINVAL);
+    return;
   }
 
   assert(m_local_image_ctx->object_map != nullptr);