From ca81563d8d71052a2040eda74e7ac418f1616fc7 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Fri, 20 Nov 2015 15:19:12 -0800 Subject: [PATCH] osd: Add stat_error for regular scrub handling Signed-off-by: David Zafman --- src/osd/PGBackend.cc | 21 +++++++++++---------- src/osd/osd_types.cc | 9 +++++++-- src/osd/osd_types.h | 3 ++- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 8d6a098382e65..10bc74d945944 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -351,9 +351,9 @@ void PGBackend::be_scan_list( << ", skipping" << dendl; } else if (r == -EIO) { dout(25) << __func__ << " " << poid << " got " << r - << ", read_error" << dendl; + << ", stat_error" << dendl; ScrubMap::object &o = map.objects[poid]; - o.read_error = true; + o.stat_error = true; } else { derr << __func__ << " got: " << cpp_strerror(r) << dendl; assert(0); @@ -370,9 +370,11 @@ enum scrub_error_type PGBackend::be_compare_scrub_objects( ostream &errorstream) { enum scrub_error_type error = CLEAN; + if (candidate.stat_error) { + error = SHALLOW_ERROR; + errorstream << "candidate had a stat error"; + } if (candidate.read_error) { - // This can occur on stat() of a shallow scrub, but in that case size will - // be invalid, and this will be over-ridden below. error = DEEP_ERROR; errorstream << "candidate had a read error"; } @@ -404,9 +406,7 @@ enum scrub_error_type PGBackend::be_compare_scrub_objects( << " from auth shard " << auth_shard; } } - // Shallow error takes precendence because this will be seen by - // both types of scrubs. - if (auth.size != candidate.size) { + if (!candidate.stat_error && auth.size != candidate.size) { if (error != CLEAN) errorstream << ", "; if (error != DEEP_ERROR) @@ -464,11 +464,12 @@ map::const_iterator if (i == j->second->objects.end()) { continue; } - if (i->second.read_error) { - // scrub encountered read error, probably corrupt + if (i->second.read_error || i->second.stat_error) { + // scrub encountered read error or stat_error, probably corrupt dout(10) << __func__ << ": rejecting osd " << j->first << " for obj " << obj - << ", read_error" + << "," << (i->second.read_error ? " read_error" : "") + << (i->second.stat_error ? " stat_error" : "") << dendl; continue; } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 37d03286bec3b..adaf8b3da92b3 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -5290,7 +5290,7 @@ void ScrubMap::generate_test_instances(list& o) void ScrubMap::object::encode(bufferlist& bl) const { - ENCODE_START(6, 2, bl); + ENCODE_START(7, 2, bl); ::encode(size, bl); ::encode(negative, bl); ::encode(attrs, bl); @@ -5301,12 +5301,13 @@ void ScrubMap::object::encode(bufferlist& bl) const ::encode(omap_digest, bl); ::encode(omap_digest_present, bl); ::encode(read_error, bl); + ::encode(stat_error, bl); ENCODE_FINISH(bl); } void ScrubMap::object::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, bl); + DECODE_START_LEGACY_COMPAT_LEN(7, 2, 2, bl); ::decode(size, bl); bool tmp; ::decode(tmp, bl); @@ -5334,6 +5335,10 @@ void ScrubMap::object::decode(bufferlist::iterator& bl) ::decode(tmp, bl); read_error = tmp; } + if (struct_v >= 7) { + ::decode(tmp, bl); + stat_error = tmp; + } DECODE_FINISH(bl); } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index b58f7d1230cbe..b3a5a3840402e 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -3850,12 +3850,13 @@ struct ScrubMap { bool digest_present:1; bool omap_digest_present:1; bool read_error:1; + bool stat_error:1; object() : // Init invalid size so it won't match if we get a stat EIO error size(-1), omap_digest(0), digest(0), nlinks(0), negative(false), digest_present(false), omap_digest_present(false), - read_error(false) {} + read_error(false), stat_error(false) {} void encode(bufferlist& bl) const; void decode(bufferlist::iterator& bl); -- 2.39.5