]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: use with_blocking_future in CompoundPeeringRequest
authorYingxin Cheng <yingxin.cheng@intel.com>
Tue, 25 Feb 2020 08:17:11 +0000 (16:17 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 25 Feb 2020 08:17:11 +0000 (16:17 +0800)
Cleanup. with_blocking_future() can cover all the use cases of
add_blocker() and clear_blocker(), and it is exception-safe and not
error-prone.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/osd/osd_operations/compound_peering_request.cc

index fa1a45f93647babce05be570aa146d4a75ac9be1..46a6d1ca3947924dcbaa7d05b64a57e4bd8c0140 100644 (file)
@@ -160,17 +160,16 @@ seastar::future<> CompoundPeeringRequest::start()
        boost::static_pointer_cast<MOSDPGCreate2>(m));
     }());
 
-  add_blocker(blocker.get());
   IRef ref = this;
   logger().info("{}: about to fork future", *this);
-  return state->promise.get_future().then(
-    [this, blocker=std::move(blocker)](auto &&ctx) {
-      clear_blocker(blocker.get());
-      logger().info("{}: sub events complete", *this);
-      return osd.get_shard_services().dispatch_context_messages(std::move(ctx));
-    }).then([this, ref=std::move(ref)] {
-      logger().info("{}: complete", *this);
-    });
+  return with_blocking_future(
+    blocker->make_blocking_future(state->promise.get_future())
+  ).then([this, blocker=std::move(blocker)](auto &&ctx) {
+    logger().info("{}: sub events complete", *this);
+    return osd.get_shard_services().dispatch_context_messages(std::move(ctx));
+  }).then([this, ref=std::move(ref)] {
+    logger().info("{}: complete", *this);
+  });
 }
 
 } // namespace crimson::osd