]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: should capture reply_t struct by reference 26255/head
authorKefu Chai <kchai@redhat.com>
Sun, 3 Feb 2019 11:43:30 +0000 (19:43 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 3 Feb 2019 12:08:59 +0000 (20:08 +0800)
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 <kchai@redhat.com>
src/crimson/osd/heartbeat.cc

index 9fee3b91d3f35de08502656ab9a2189d314bfc1e..c075ad6867dabffeaff6eaf386126e47459463d8 100644 (file)
@@ -297,7 +297,7 @@ seastar::future<> Heartbeat::send_heartbeats()
       std::vector<ceph::net::ConnectionRef> 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<uint32_t>(
               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 {