From: Kefu Chai Date: Sun, 3 Feb 2019 11:43:30 +0000 (+0800) Subject: crimson/osd: should capture reply_t struct by reference X-Git-Tag: v14.1.0~159^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bdef1dabe43035083b193b1c7eb92bfeef389341;p=ceph.git crimson/osd: should capture reply_t struct by reference before this change, the iterator is captured by value, but it could be invalidated when more elements are inserted into the container. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/heartbeat.cc b/src/crimson/osd/heartbeat.cc index 9fee3b91d3f3..c075ad6867da 100644 --- a/src/crimson/osd/heartbeat.cc +++ b/src/crimson/osd/heartbeat.cc @@ -297,7 +297,7 @@ seastar::future<> Heartbeat::send_heartbeats() std::vector conns{info.con_front, info.con_back}; return seastar::parallel_for_each(std::move(conns), - [=] (auto con) { + [sent_stamp, &reply=reply->second, this] (auto con) { if (con) { auto min_message = static_cast( local_conf()->osd_heartbeat_min_size); @@ -307,7 +307,7 @@ seastar::future<> Heartbeat::send_heartbeats() sent_stamp, min_message); return con->send(ping).then([&reply] { - reply->second.unacknowledged++; + reply.unacknowledged++; return seastar::now(); }); } else {