Skip to content

Commit 1f80b38

Browse files
committed
crimson/osd/recovery_backend: _handle_pull_response to use obc_manager
Signed-off-by: Matan Breizman <[email protected]>
1 parent a0df2e5 commit 1f80b38

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

src/crimson/osd/replicated_recovery_backend.cc

+36-33
Original file line numberDiff line numberDiff line change
@@ -837,39 +837,42 @@ ReplicatedRecoveryBackend::_handle_pull_response(
837837
pull_info.recovery_info.version = push_op.version;
838838

839839
if (pull_info.recovery_progress.first) {
840-
auto fut = pg.obc_loader.with_obc<RWState::RWNONE>(
841-
pull_info.recovery_info.soid,
842-
[FNAME, this, &pull_info, &recovery_waiter, &push_op](auto, auto obc) {
843-
pull_info.obc = obc;
844-
recovery_waiter.obc = obc;
845-
obc->obs.oi.decode_no_oid(push_op.attrset.at(OI_ATTR),
846-
push_op.soid);
847-
auto ss_attr_iter = push_op.attrset.find(SS_ATTR);
848-
if (ss_attr_iter != push_op.attrset.end()) {
849-
if (!obc->ssc) {
850-
obc->ssc = new crimson::osd::SnapSetContext(
851-
push_op.soid.get_snapdir());
852-
}
853-
try {
854-
obc->ssc->snapset = SnapSet(ss_attr_iter->second);
855-
obc->ssc->exists = true;
856-
} catch (const buffer::error&) {
857-
WARNDPP("unable to decode SnapSet", pg);
858-
throw crimson::osd::invalid_argument();
859-
}
860-
assert(!pull_info.obc->ssc->exists ||
861-
obc->ssc->snapset.seq == pull_info.obc->ssc->snapset.seq);
862-
}
863-
pull_info.recovery_info.oi = obc->obs.oi;
864-
if (pull_info.recovery_info.soid.snap &&
865-
pull_info.recovery_info.soid.snap < CEPH_NOSNAP) {
866-
recalc_subsets(pull_info.recovery_info,
867-
pull_info.obc->ssc);
868-
}
869-
return crimson::osd::PG::load_obc_ertr::now();
870-
}, false).handle_error_interruptible(crimson::ct_error::assert_all{});
871-
co_await std::move(fut);
872-
};
840+
auto obc_manager = pg.obc_loader.get_obc_manager(pull_info.recovery_info.soid);
841+
co_await pg.obc_loader.load_and_lock(
842+
obc_manager, RWState::RWNONE
843+
).handle_error_interruptible(
844+
crimson::ct_error::assert_all("unexpected error")
845+
);
846+
847+
auto obc = obc_manager.get_obc();
848+
pull_info.obc = obc;
849+
recovery_waiter.obc = obc;
850+
// TODO: move to ObjectContextLoader once constructing obc from attrset is supported
851+
obc->obs.oi.decode_no_oid(push_op.attrset.at(OI_ATTR),
852+
push_op.soid);
853+
auto ss_attr_iter = push_op.attrset.find(SS_ATTR);
854+
if (ss_attr_iter != push_op.attrset.end()) {
855+
if (!obc->ssc) {
856+
obc->ssc = new crimson::osd::SnapSetContext(
857+
push_op.soid.get_snapdir());
858+
}
859+
try {
860+
obc->ssc->snapset = SnapSet(ss_attr_iter->second);
861+
obc->ssc->exists = true;
862+
} catch (const buffer::error&) {
863+
WARNDPP("unable to decode SnapSet", pg);
864+
throw crimson::osd::invalid_argument();
865+
}
866+
assert(!pull_info.obc->ssc->exists ||
867+
obc->ssc->snapset.seq == pull_info.obc->ssc->snapset.seq);
868+
}
869+
pull_info.recovery_info.oi = obc->obs.oi;
870+
if (pull_info.recovery_info.soid.snap &&
871+
pull_info.recovery_info.soid.snap < CEPH_NOSNAP) {
872+
recalc_subsets(pull_info.recovery_info,
873+
pull_info.obc->ssc);
874+
}
875+
}
873876

874877
const bool first = pull_info.recovery_progress.first;
875878
pull_info.recovery_progress = push_op.after_progress;

0 commit comments

Comments
 (0)