From d89516072dd27f4d9837503f498e6bfc9e93a276 Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Mon, 14 Apr 2025 18:21:08 +0530 Subject: [PATCH] crimson: Create the shared promise before waited upon 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 Signed-off-by: Mohit Agrawal (cherry picked from commit 435f065a13c661c4f2439dee340a786ca4b5f31e) --- src/crimson/osd/recovery_backend.h | 8 +++----- src/crimson/osd/replicated_recovery_backend.cc | 10 ++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/crimson/osd/recovery_backend.h b/src/crimson/osd/recovery_backend.h index adffc0b9ac42e..6198cb11787c5 100644 --- a/src/crimson/osd/recovery_backend.h +++ b/src/crimson/osd/recovery_backend.h @@ -220,11 +220,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) { diff --git a/src/crimson/osd/replicated_recovery_backend.cc b/src/crimson/osd/replicated_recovery_backend.cc index 27d841dfb19ed..71a1deef575be 100644 --- a/src/crimson/osd/replicated_recovery_backend.cc +++ b/src/crimson/osd/replicated_recovery_backend.cc @@ -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); }); }); }); @@ -184,11 +185,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<>(); -- 2.39.5