Skip to content

Commit df1ae4d

Browse files
authored
Merge pull request ceph#56375 from athanatos/sjust/wip-64996-deepscrub-crash
crimson/.../scrub_events: fix progress lifetime in deep_scan_object Reviewed-by: Yingxin Cheng <[email protected]> Reviewed-by: Radoslaw Zarzynski <[email protected]> Reviewed-by: Chunmei Liu <[email protected]>
2 parents b3cfa10 + 3276ad5 commit df1ae4d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/crimson/osd/osd_operations/scrub_events.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,10 @@ ScrubScan::ifut<> ScrubScan::deep_scan_object(
258258
DEBUGDPP("obj: {}", pg, obj);
259259
using crimson::common::local_conf;
260260
auto &entry = ret.objects[obj.hobj];
261+
auto progress_ref = std::make_unique<obj_scrub_progress_t>();
262+
auto &progress = *progress_ref;
261263
return interruptor::repeat(
262-
[FNAME, this, progress = obj_scrub_progress_t(),
263-
&obj, &entry, &pg]() mutable
264+
[FNAME, this, &progress, &obj, &entry, &pg]()
264265
-> interruptible_future<seastar::stop_iteration> {
265266
if (progress.offset) {
266267
DEBUGDPP("op: {}, obj: {}, progress: {} scanning data",
@@ -272,7 +273,10 @@ ScrubScan::ifut<> ScrubScan::deep_scan_object(
272273
obj,
273274
*(progress.offset),
274275
stride
275-
).safe_then([stride, &progress, &entry](auto bl) {
276+
).safe_then([this, FNAME, stride, &obj, &progress, &entry, &pg](auto bl) {
277+
size_t offset = *progress.offset;
278+
DEBUGDPP("op: {}, obj: {}, progress: {} got offset {}",
279+
pg, *this, obj, progress, offset);
276280
progress.data_hash << bl;
277281
if (bl.length() < stride) {
278282
progress.offset = std::nullopt;
@@ -373,7 +377,7 @@ ScrubScan::ifut<> ScrubScan::deep_scan_object(
373377
seastar::make_ready_future<seastar::stop_iteration>(
374378
seastar::stop_iteration::yes));
375379
}
376-
});
380+
}).finally([progress_ref=std::move(progress_ref)] {});
377381
}
378382

379383
template class ScrubAsyncOpT<ScrubScan>;

0 commit comments

Comments
 (0)