]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: Create the shared promise before waited upon 62760/head
authorMohit Agrawal <moagrawa@redhat.com>
Mon, 14 Apr 2025 12:51:08 +0000 (18:21 +0530)
committerMohit Agrawal <moagrawa@redhat.com>
Sun, 27 Apr 2025 11:40:29 +0000 (17:10 +0530)
RecoveryBackend::pushes map creates each shared_promise
in wait_for_pushes call. There can be a situation where
set_pushed is called due to handled push reply (handle_push_reply)
before the shared_promise was even constructed due to backfill progress
is stuck.

Fixes: https://tracker.ceph.com/issues/70502
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
src/crimson/osd/recovery_backend.h
src/crimson/osd/replicated_recovery_backend.cc

index 818e85f67b1d9c282b0f39d64edaa104c36951e1..4acfc8b9db4217882c99c42b424019a5d1693bfe 100644 (file)
@@ -214,11 +214,9 @@ public:
     }
     void set_pushed(pg_shard_t shard) {
       auto it = pushes.find(shard);
-      if (it != pushes.end()) {
-       auto &push_promise = it->second;
-       push_promise.set_value();
-       pushes.erase(it);
-      }
+      ceph_assert(it != pushes.end());
+      it->second.set_value();
+      pushes.erase(it);
     }
     void set_pulled() {
       if (pulled) {
index 9b40edbfc6dd1cd2e7ff1bc1d3d17d8f9c7ea65c..aa52f2dc256724b778a0dbb19d6c1e917f8d1f71 100644 (file)
@@ -81,13 +81,14 @@ ReplicatedRecoveryBackend::maybe_push_shards(
         msg->min_epoch = pg.get_last_peering_reset();
         msg->pushes.push_back(std::move(push));
         msg->set_priority(pg.get_recovery_op_priority());
+        seastar::future<> push_future = get_recovering(soid).wait_for_pushes(shard);
         return interruptor::make_interruptible(
             shard_services.send_to_osd(shard.osd,
                                        std::move(msg),
                                        pg.get_osdmap_epoch()))
         .then_interruptible(
-          [this, soid, shard] {
-          return get_recovering(soid).wait_for_pushes(shard);
+          [push_future = std::move(push_future)]() mutable {
+          return std::move(push_future);
         });
       });
     });
@@ -183,11 +184,12 @@ ReplicatedRecoveryBackend::push_delete(
          pg.get_pg_whoami(), target_pg, pg.get_osdmap_epoch(), min_epoch);
       msg->set_priority(pg.get_recovery_op_priority());
       msg->objects.push_back(std::make_pair(soid, need));
+      seastar::future<> push_future = get_recovering(soid).wait_for_pushes(shard);
       return interruptor::make_interruptible(
          shard_services.send_to_osd(shard.osd, std::move(msg),
                                     pg.get_osdmap_epoch())).then_interruptible(
-       [this, soid, shard] {
-       return get_recovering(soid).wait_for_pushes(shard);
+        [push_future = std::move(push_future)]() mutable {
+        return std::move(push_future);
       });
     }
     return seastar::make_ready_future<>();