]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
crimson/common/smp_helpers: fix reactor_map_seq
authorMatan Breizman <mbreizma@redhat.com>
Sun, 22 Jun 2025 10:10:10 +0000 (10:10 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 23 Jun 2025 10:38:48 +0000 (10:38 +0000)
commit550b2b8ade7e10078ab9610442d039b65cce6a2b
tree77df39d15ebe5af1bbeb685e1904167a96ed9f9d
parentc45e18bd4f4f87abda3cf1dfc51155eadaaca32c
crimson/common/smp_helpers: fix reactor_map_seq

Copy f into reactor_map_seq which would be kept alive
due to this method being a coroutine. That way, we can ensure
the lambdas passed to each core that are capturing f by
reference would be safe.
Alternatively, we can also copy f by using it's copy ctor and
pass a copy to each shard:
co_await crimson::submit_to(core, F(f))
However, avoiding the copy is possible here due to the sequential
traversal. Note, seastar's invoke_on_all do copy each callback to
every shard and is running the invocation in parallel.

The above would have fixed f's captures to be invalid and result
in a segfaults on diffrent shards.

Fixes: https://tracker.ceph.com/issues/71457
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/common/smp_helpers.h