From 3117d59f08963c8f09dae8fd4b65d0b1951a8daa Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Tue, 25 Feb 2020 16:17:11 +0800 Subject: [PATCH] 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 --- .../osd_operations/compound_peering_request.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/crimson/osd/osd_operations/compound_peering_request.cc b/src/crimson/osd/osd_operations/compound_peering_request.cc index fa1a45f9364..46a6d1ca394 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 -- 2.47.3