Skip to content

Commit 409818f

Browse files
authored
Merge pull request ceph#61590 from ronen-fr/wip-rf-noinfo-repair
osd/scrub: discard repair_oinfo_oid() Reviewed-by: Samuel Just <[email protected]>
2 parents 519844b + 7853731 commit 409818f

File tree

3 files changed

+13
-55
lines changed

3 files changed

+13
-55
lines changed

src/osd/scrubber/pg_scrubber.cc

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,60 +1413,13 @@ int PgScrubber::build_scrub_map_chunk(ScrubMap& map,
14131413
}
14141414

14151415
// finish
1416-
dout(20) << __func__ << " finishing" << dendl;
14171416
ceph_assert(pos.done());
1418-
repair_oinfo_oid(map);
1419-
1420-
dout(20) << __func__ << " done, got " << map.objects.size() << " items"
1421-
<< dendl;
1417+
dout(20) << fmt::format("{}: done. {} objects in scrub-map", __func__,
1418+
map.objects.size())
1419+
<< dendl;
14221420
return 0;
14231421
}
14241422

1425-
/// \todo consider moving repair_oinfo_oid() back to the backend
1426-
void PgScrubber::repair_oinfo_oid(ScrubMap& smap)
1427-
{
1428-
for (auto i = smap.objects.rbegin(); i != smap.objects.rend(); ++i) {
1429-
1430-
const hobject_t& hoid = i->first;
1431-
ScrubMap::object& o = i->second;
1432-
1433-
if (o.attrs.find(OI_ATTR) == o.attrs.end()) {
1434-
continue;
1435-
}
1436-
object_info_t oi;
1437-
try {
1438-
oi.decode(o.attrs[OI_ATTR]);
1439-
} catch (...) {
1440-
continue;
1441-
}
1442-
1443-
if (oi.soid != hoid) {
1444-
ObjectStore::Transaction t;
1445-
OSDriver::OSTransaction _t(m_pg->osdriver.get_transaction(&t));
1446-
1447-
m_osds->clog->error()
1448-
<< "osd." << m_pg_whoami << " found object info error on pg " << m_pg_id
1449-
<< " oid " << hoid << " oid in object info: " << oi.soid
1450-
<< "...repaired";
1451-
// Fix object info
1452-
oi.soid = hoid;
1453-
bufferlist bl;
1454-
encode(oi,
1455-
bl,
1456-
m_pg->get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
1457-
1458-
o.attrs[OI_ATTR] = std::move(bl);
1459-
1460-
t.setattr(m_pg->coll, ghobject_t(hoid), OI_ATTR, bl);
1461-
int r = m_pg->osd->store->queue_transaction(m_pg->ch, std::move(t));
1462-
if (r != 0) {
1463-
derr << __func__ << ": queue_transaction got " << cpp_strerror(r)
1464-
<< dendl;
1465-
}
1466-
}
1467-
}
1468-
}
1469-
14701423

14711424
void PgScrubber::run_callbacks()
14721425
{

src/osd/scrubber/pg_scrubber.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,6 @@ class PgScrubber : public ScrubPgIF,
703703
epoch_t m_interval_start{0}; ///< interval's 'from' of when scrubbing was
704704
///< first scheduled
705705

706-
void repair_oinfo_oid(ScrubMap& smap);
707-
708706
/*
709707
* the exact epoch when the scrubbing actually started (started here - cleared
710708
* checks for no-scrub conf). Incoming events are verified against this, with

src/osd/scrubber/scrub_backend.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,17 @@ shard_as_auth_t ScrubBackend::possible_auth_shard(const hobject_t& obj,
717717
return shard_as_auth_t{errstream.str()};
718718
}
719719
}
720-
}
721720

722-
// This is automatically corrected in repair_oinfo_oid()
723-
ceph_assert(oi.soid == obj);
721+
if (!dup_error_cond(err,
722+
false,
723+
(oi.soid != obj),
724+
shard_info,
725+
&shard_info_wrapper::set_info_corrupted,
726+
"candidate info oid mismatch"sv,
727+
errstream)) {
728+
return shard_as_auth_t{errstream.str()};
729+
}
730+
}
724731

725732
if (test_error_cond(smap_obj.size != logical_to_ondisk_size(oi.size),
726733
shard_info,

0 commit comments

Comments
 (0)