]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/recovery_backend: scan_for_backfill to use seastar::lambda
authorMatan Breizman <mbreizma@redhat.com>
Mon, 10 Mar 2025 12:46:04 +0000 (12:46 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 10 Mar 2025 12:54:15 +0000 (12:54 +0000)
We could also use here seastar::coroutine::parallel_for_each. However,
an `interruptible` overload must be used. Instead, use the coroutine
which wrapper is simpler this time.

```
kernel callstack:
    #0 0x56f6e7a in seastar::lw_shared_ptr<std::map<hobject_t, eversion_t, std::less<hobject_t>, std::allocator<std::pair<hobject_t const, eversion_t> > > >::operator->() const /home/matan/ceph/src/seastar/include/seastar/core/shared_ptr.hh:347
    #1 0x56f6e7a in operator() /home/matan/ceph/src/crimson/osd/recovery_backend.cc:245
    #2 0x5286c62 in std::__n4861::coroutine_handle<crimson::internal::promise_base<crimson::interruptible::interruptor<crimson::osd::IOInterruptCondition>, void, void> >::resume() const /opt/rh/gcc-toolset-13/root/usr/include/c++/13/coroutine:24

SUMMARY: AddressSanitizer: stack-use-after-return /home/matan/ceph/src/seastar/include/seastar/core/shared_ptr.hh:347 in seastar::lw_shared_ptr<std::map<hobject_t, eversion_t, std::less<hobject_t>, std::allocator<std::pair<hobject_t const, eversion_t> >

```

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/osd/recovery_backend.cc

index 2d5ab2b89ae32cd8c5205c7e0eca2b864cd7cb59..892419eeb94655caa3162370348bf5718190da89 100644 (file)
@@ -230,7 +230,7 @@ RecoveryBackend::scan_for_backfill(
   DEBUGDPP("starting from {}", pg, start);
   auto version_map = seastar::make_lw_shared<std::map<hobject_t, eversion_t>>();
   auto&& [objects, next] = co_await backend->list_objects(start, max);
-  co_await interruptor::parallel_for_each(objects, [FNAME, this, version_map]
+  co_await interruptor::parallel_for_each(objects, seastar::coroutine::lambda([FNAME, this, version_map]
     (const hobject_t& object) -> interruptible_future<> {
     DEBUGDPP("querying obj:{}", pg, object);
     auto obc_manager = pg.obc_loader.get_obc_manager(object);
@@ -252,7 +252,7 @@ RecoveryBackend::scan_for_backfill(
       // for the first item in the range, which is usually last_backfill.
       co_return;
     }
-  });
+  }));
   BackfillInterval bi;
   bi.begin = std::move(start);
   bi.end = std::move(next);