]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add stat_error for regular scrub handling
authorDavid Zafman <dzafman@redhat.com>
Fri, 20 Nov 2015 23:19:12 +0000 (15:19 -0800)
committerDavid Zafman <dzafman@redhat.com>
Mon, 4 Jan 2016 19:16:48 +0000 (11:16 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/PGBackend.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index 8d6a098382e65fbf0843786a82ea05329857a4d5..10bc74d945944b242fc36a297b3c4dee8070d688 100644 (file)
@@ -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<pg_shard_t, ScrubMap *>::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;
     }
index 37d03286bec3b8e1cbac379ad3401e5bf778f19f..adaf8b3da92b32f12cd27baab4a2ebe287009766 100644 (file)
@@ -5290,7 +5290,7 @@ void ScrubMap::generate_test_instances(list<ScrubMap*>& 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);
 }
 
index b58f7d1230cbe30787a1ab9796cee2c889eaf364..b3a5a3840402eaddf41fa7b72d032311f05c7584 100644 (file)
@@ -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);