From: Xuehan Xu Date: Wed, 23 Oct 2024 04:57:35 +0000 (+0800) Subject: crimson/osd/shard_services: fix dangling reference caused by rvalue X-Git-Tag: testing/wip-pdonnell-testing-20241106.142118-debug~28^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f39c9232e1873e08f0181d5449340d16723f13f8;p=ceph-ci.git crimson/osd/shard_services: fix dangling reference caused by rvalue reference of ShardSercies::dispatch_context() Fixes: https://tracker.ceph.com/issues/68662 Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/osd/shard_services.cc b/src/crimson/osd/shard_services.cc index a053d9d5044..c2340898929 100644 --- a/src/crimson/osd/shard_services.cc +++ b/src/crimson/osd/shard_services.cc @@ -802,15 +802,19 @@ seastar::future<> ShardServices::dispatch_context_messages( seastar::future<> ShardServices::dispatch_context( crimson::os::CollectionRef col, - PeeringCtx &&ctx) -{ - ceph_assert(col || ctx.transaction.empty()); - return seastar::when_all_succeed( - dispatch_context_messages( - BufferedRecoveryMessages{ctx}), - col ? dispatch_context_transaction(col, ctx) : seastar::now() - ).then_unpack([] { - return seastar::now(); + PeeringCtx &&pctx) +{ + return seastar::do_with( + std::move(pctx), + [this, col](auto &ctx) { + ceph_assert(col || ctx.transaction.empty()); + return seastar::when_all_succeed( + dispatch_context_messages( + BufferedRecoveryMessages{ctx}), + col ? dispatch_context_transaction(col, ctx) : seastar::now() + ).then_unpack([] { + return seastar::now(); + }); }); }