]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: capture variable on stack by value
authorKefu Chai <kchai@redhat.com>
Sat, 19 Dec 2020 10:22:08 +0000 (18:22 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 19 Dec 2020 12:02:06 +0000 (20:02 +0800)
start is passed either by std::move() or by a plain value. neither of
them ensure that the parameter can outlive the continuations in
`RecoveryBackend::scan_for_backfill()`. so, we should capture it by
value.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/recovery_backend.cc

index f73a981537611950a843bab6e0177a084cb8fb77..aeec0d14be93821723c9d434e3e9078d85557384 100644 (file)
@@ -161,7 +161,7 @@ seastar::future<BackfillInterval> RecoveryBackend::scan_for_backfill(
   logger().debug("{} starting from {}", __func__, start);
   auto version_map = seastar::make_lw_shared<std::map<hobject_t, eversion_t>>();
   return backend->list_objects(start, max).then(
-    [this, &start, version_map] (auto&& ret) {
+    [this, start, version_map] (auto&& ret) {
     auto&& [objects, next] = std::move(ret);
     return seastar::parallel_for_each(std::move(objects),
       [this, version_map] (const hobject_t& object) {
@@ -191,9 +191,9 @@ seastar::future<BackfillInterval> RecoveryBackend::scan_for_backfill(
           return seastar::now();
         }, PGBackend::load_metadata_ertr::assert_all{});
       }
-    }).then([version_map, &start, next=std::move(next), this] {
+    }).then([version_map, start=std::move(start), next=std::move(next), this] {
       BackfillInterval bi;
-      bi.begin = start;
+      bi.begin = std::move(start);
       bi.end = std::move(next);
       bi.version = pg.get_info().last_update;
       bi.objects = std::move(*version_map);