From: Mohit Agrawal Date: Mon, 14 Apr 2025 12:51:08 +0000 (+0530) Subject: crimson: Create the shared promise before waited upon X-Git-Tag: testing/wip-vshankar-testing-20250505.162437-debug~33^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=435f065a13c661c4f2439dee340a786ca4b5f31e;p=ceph-ci.git 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 --- diff --git a/src/crimson/osd/recovery_backend.h b/src/crimson/osd/recovery_backend.h index 818e85f67b1..4acfc8b9db4 100644 --- a/src/crimson/osd/recovery_backend.h +++ b/src/crimson/osd/recovery_backend.h @@ -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) { diff --git a/src/crimson/osd/replicated_recovery_backend.cc b/src/crimson/osd/replicated_recovery_backend.cc index 9b40edbfc6d..aa52f2dc256 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); }); }); }); @@ -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<>();