]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: compare nlinks to snapcolls
authorSamuel Just <sam.just@inktank.com>
Thu, 10 Jan 2013 00:41:40 +0000 (16:41 -0800)
committerSage Weil <sage@inktank.com>
Wed, 23 Jan 2013 14:21:58 +0000 (06:21 -0800)
nlinks gives us the number of hardlinks to the object.
nlinks should be 1 + snapcolls.size().  This will allow
us to detect links which remain in an erroneous snap
collection.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit e65ea70ea64025fbb0709ee8596bb2878be0bbdc)

src/osd/ReplicatedPG.cc

index a487a713e01c50cbc48e90793bd5efc50a0dd1b8..1e65ece61aa6cf2529608e773426ffc2ec7d42d1 100644 (file)
@@ -7240,6 +7240,12 @@ bool ReplicatedPG::_report_snap_collection_errors(
        << std::endl;
     errors = true;
   }
+  if (nlinks != snapcolls.size() + 1) {
+    out << info.pgid << " osd." << osd << " unaccounted for links on object "
+       << hoid << " snapcolls " << snapcolls << " nlinks " << nlinks
+       << std::endl;
+    errors = true;
+  }
   return errors;
 }