Skip to content

Commit 547d13f

Browse files
committed
osd/scrub: avoid using moved-from auth_n_errs
... in ScrubBackend::inconsistents() Existing code was using a reference to a moved-from `auth_and_obj_errs_t` object, which is undefined behavior. The change here was tested locally. No noticeable performance degradation was observed, and the code is now more robust. Fixes: https://tracker.ceph.com/issues/72426 Signed-off-by: Ronen Friedman <[email protected]>
1 parent 94bb77d commit 547d13f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/osd/scrubber/scrub_backend.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,18 +1019,15 @@ void ScrubBackend::inconsistents(const hobject_t& ho,
10191019
auth_and_obj_errs_t&& auth_n_errs,
10201020
stringstream& errstream)
10211021
{
1022-
auto& object_errors = auth_n_errs.object_errors;
1023-
auto& auth_list = auth_n_errs.auth_list;
1024-
1025-
m_current_obj.cur_inconsistent.insert(object_errors.begin(),
1026-
object_errors.end()); // merge?
1022+
m_current_obj.cur_inconsistent.insert(auth_n_errs.object_errors.begin(),
1023+
auth_n_errs.object_errors.end());
10271024

10281025
dout(15) << fmt::format(
10291026
"{}: object errors #: {} auth list #: {} cur_missing #: {} "
10301027
"cur_incon #: {}",
10311028
__func__,
1032-
object_errors.size(),
1033-
auth_list.size(),
1029+
auth_n_errs.object_errors.size(),
1030+
auth_n_errs.auth_list.size(),
10341031
m_current_obj.cur_missing.size(),
10351032
m_current_obj.cur_inconsistent.size())
10361033
<< dendl;
@@ -1058,8 +1055,7 @@ void ScrubBackend::inconsistents(const hobject_t& ho,
10581055

10591056
if (!m_current_obj.cur_inconsistent.empty() ||
10601057
!m_current_obj.cur_missing.empty()) {
1061-
1062-
this_chunk->authoritative[ho] = auth_list;
1058+
this_chunk->authoritative[ho] = std::move(auth_n_errs.auth_list);
10631059

10641060
} else if (!m_current_obj.fix_digest && m_is_replicated) {
10651061

0 commit comments

Comments
 (0)