]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: potential crash if object map check encounters error 20253/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 31 Jan 2018 21:52:52 +0000 (16:52 -0500)
committerPrashant D <pdhange@redhat.com>
Fri, 2 Feb 2018 05:50:44 +0000 (00:50 -0500)
Fixes: http://tracker.ceph.com/issues/22819
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit c8d32546095829663022d9d6331809b1f311b839)

src/librbd/Operations.cc
src/librbd/operation/ObjectMapIterate.cc

index 393a8b2d7c80a212ea570ddd34b41cb5293aee99..6a1bd3ec0257e143cf7d35c50feda0f77a07c389 100644 (file)
@@ -481,7 +481,9 @@ int Operations<I>::check_object_map(ProgressContext &prog_ctx) {
   r = invoke_async_request("check object map", true,
                            boost::bind(&Operations<I>::check_object_map, this,
                                        boost::ref(prog_ctx), _1),
-                          [] (Context *c) { c->complete(-EOPNOTSUPP); });
+                          [this](Context *c) {
+                             m_image_ctx.op_work_queue->queue(c, -EOPNOTSUPP);
+                           });
 
   return r;
 }
index 1e4b854bddd500f8e0ff7d77427ee42d3c2aab0e..68d2d1137835a573d9c8ca904a9445890ebe14fa 100644 (file)
@@ -200,12 +200,17 @@ template <typename I>
 bool ObjectMapIterateRequest<I>::should_complete(int r) {
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << " should_complete: " << " r=" << r << dendl;
+  if (r < 0) {
+    lderr(cct) << "object map operation encountered an error: "
+              << cpp_strerror(r) << dendl;
+  }
 
   RWLock::RLocker owner_lock(m_image_ctx.owner_lock);
   switch (m_state) {
   case STATE_VERIFY_OBJECTS:
     if (m_invalidate.test_and_set()) {
       send_invalidate_object_map();
+      return false;
     } else if (r == 0) {
       return true;
     }
@@ -223,9 +228,6 @@ bool ObjectMapIterateRequest<I>::should_complete(int r) {
   }
 
   if (r < 0) {
-    lderr(cct) << "object map operation encountered an error: "
-              << cpp_strerror(r)
-               << dendl;
     return true;
   }