From: Yingxin Cheng Date: Tue, 25 Feb 2020 08:17:11 +0000 (+0800) Subject: crimson/osd: use with_blocking_future in CompoundPeeringRequest X-Git-Tag: v15.1.1~251^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3117d59f08963c8f09dae8fd4b65d0b1951a8daa;p=ceph.git crimson/osd: use with_blocking_future in CompoundPeeringRequest 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 --- diff --git a/src/crimson/osd/osd_operations/compound_peering_request.cc b/src/crimson/osd/osd_operations/compound_peering_request.cc index fa1a45f93647..46a6d1ca3947 100644 --- a/src/crimson/osd/osd_operations/compound_peering_request.cc +++ b/src/crimson/osd/osd_operations/compound_peering_request.cc @@ -160,17 +160,16 @@ seastar::future<> CompoundPeeringRequest::start() boost::static_pointer_cast(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