Skip to content

Commit cbd22c7

Browse files
committed
crimson/osd/pg: fix dangerous lambda captures
In PG::submit_transaction(), osd_op_p was first moved to ReplicatedBackend::submit_transaction(), and later its at_version is captured in another lambda. The latter may be already empty at the time of the capture. Signed-off-by: Xuehan Xu <[email protected]>
1 parent 1c93566 commit cbd22c7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/crimson/osd/pg.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,9 @@ PG::submit_transaction(
924924
}
925925

926926
epoch_t map_epoch = get_osdmap_epoch();
927+
auto at_version = osd_op_p.at_version;
927928

928-
peering_state.pre_submit_op(obc->obs.oi.soid, log_entries, osd_op_p.at_version);
929+
peering_state.pre_submit_op(obc->obs.oi.soid, log_entries, at_version);
929930
peering_state.update_trim_to();
930931

931932
ceph_assert(!log_entries.empty());
@@ -947,8 +948,8 @@ PG::submit_transaction(
947948
co_return std::make_tuple(
948949
std::move(submitted),
949950
all_completed.then_interruptible(
950-
[this, last_complete=peering_state.get_info().last_complete,
951-
at_version=osd_op_p.at_version](auto acked) {
951+
[this, at_version,
952+
last_complete=peering_state.get_info().last_complete](auto acked) {
952953
for (const auto& peer : acked) {
953954
peering_state.update_peer_last_complete_ondisk(
954955
peer.shard, peer.last_complete_ondisk);

0 commit comments

Comments
 (0)