From 353b7341caff86f936a429669de52e6949a89c2b Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 9 Jan 2013 16:41:40 -0800 Subject: [PATCH] ReplicatedPG: compare nlinks to snapcolls 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 (cherry picked from commit e65ea70ea64025fbb0709ee8596bb2878be0bbdc) --- src/osd/ReplicatedPG.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a487a713e01c5..1e65ece61aa6c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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; } -- 2.39.5