Skip to content

Commit d895160

Browse files
committed
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 <[email protected]> Signed-off-by: Mohit Agrawal <[email protected]> (cherry picked from commit 435f065)
1 parent 2ed4296 commit d895160

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/crimson/osd/recovery_backend.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,9 @@ class RecoveryBackend {
220220
}
221221
void set_pushed(pg_shard_t shard) {
222222
auto it = pushes.find(shard);
223-
if (it != pushes.end()) {
224-
auto &push_promise = it->second;
225-
push_promise.set_value();
226-
pushes.erase(it);
227-
}
223+
ceph_assert(it != pushes.end());
224+
it->second.set_value();
225+
pushes.erase(it);
228226
}
229227
void set_pulled() {
230228
if (pulled) {

src/crimson/osd/replicated_recovery_backend.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ ReplicatedRecoveryBackend::maybe_push_shards(
8181
msg->min_epoch = pg.get_last_peering_reset();
8282
msg->pushes.push_back(std::move(push));
8383
msg->set_priority(pg.get_recovery_op_priority());
84+
seastar::future<> push_future = get_recovering(soid).wait_for_pushes(shard);
8485
return interruptor::make_interruptible(
8586
shard_services.send_to_osd(shard.osd,
8687
std::move(msg),
8788
pg.get_osdmap_epoch()))
8889
.then_interruptible(
89-
[this, soid, shard] {
90-
return get_recovering(soid).wait_for_pushes(shard);
90+
[push_future = std::move(push_future)]() mutable {
91+
return std::move(push_future);
9192
});
9293
});
9394
});
@@ -184,11 +185,12 @@ ReplicatedRecoveryBackend::push_delete(
184185
pg.get_pg_whoami(), target_pg, pg.get_osdmap_epoch(), min_epoch);
185186
msg->set_priority(pg.get_recovery_op_priority());
186187
msg->objects.push_back(std::make_pair(soid, need));
188+
seastar::future<> push_future = get_recovering(soid).wait_for_pushes(shard);
187189
return interruptor::make_interruptible(
188190
shard_services.send_to_osd(shard.osd, std::move(msg),
189191
pg.get_osdmap_epoch())).then_interruptible(
190-
[this, soid, shard] {
191-
return get_recovering(soid).wait_for_pushes(shard);
192+
[push_future = std::move(push_future)]() mutable {
193+
return std::move(push_future);
192194
});
193195
}
194196
return seastar::make_ready_future<>();

0 commit comments

Comments
 (0)