]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Don't crash if OI_ATTR attribute is missing or corrupt
authorDavid Zafman <dzafman@redhat.com>
Mon, 28 Sep 2015 17:59:42 +0000 (10:59 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 30 Oct 2015 20:01:41 +0000 (13:01 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/PG.cc
src/osd/osd_types.h

index c6e2d38260fd993780fd7e22f64bb0dc285b265e..dc5dde452a79f2f35d00c9600aa82aa74806512f 100644 (file)
@@ -3503,8 +3503,18 @@ void PG::_scan_snaps(ScrubMap &smap)
     if (hoid.snap < CEPH_MAXSNAP) {
       // fake nlinks for old primaries
       bufferlist bl;
+      if (o.attrs.find(OI_ATTR) == o.attrs.end()) {
+       o.nlinks = 0;
+       continue;
+      }
       bl.push_back(o.attrs[OI_ATTR]);
-      object_info_t oi(bl);
+      object_info_t oi;
+      try {
+       oi = bl;
+      } catch(...) {
+       o.nlinks = 0;
+       continue;
+      }
       if (oi.snaps.empty()) {
        // Just head
        o.nlinks = 1;
index 8d04c2477ca33656a565cbe75ca851a70bda761e..adcceee497cf8bf2a7fb107e83b8896cf5fbc6f6 100644 (file)
@@ -3143,6 +3143,10 @@ struct object_info_t {
   object_info_t(bufferlist& bl) {
     decode(bl);
   }
+  object_info_t operator=(bufferlist& bl) {
+    decode(bl);
+    return *this;
+  }
 };
 WRITE_CLASS_ENCODER(object_info_t)