]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd/shard_services: fix dangling reference caused by rvalue
authorXuehan Xu <xuxuehan@qianxin.com>
Wed, 23 Oct 2024 04:57:35 +0000 (12:57 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Wed, 23 Oct 2024 08:19:47 +0000 (16:19 +0800)
reference of ShardSercies::dispatch_context()

Fixes: https://tracker.ceph.com/issues/68662
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/osd/shard_services.cc

index a053d9d5044c5f2591fe1b5f5831f4f5832295ac..c23408989293dd4d7510972a2d7d1ef26142e8ef 100644 (file)
@@ -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();
+    });
   });
 }