From: Samuel Just Date: Tue, 4 Jan 2011 00:48:39 +0000 (-0800) Subject: PG: Fix bug in scrub when checking clone sizes X-Git-Tag: v0.24.1~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a4a1e53c7d380cd0b582c1d0685fd0ef4ef1711;p=ceph.git PG: Fix bug in scrub when checking clone sizes Previosly, _scrub checked: assert(p->second.size == snapset.clone_size[curclone]) curclone was, however, an index into snapset.clones rather than a snapid_t. For clarity, curclone is now an iterator. Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index df2b756752d..2361543ee99 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3985,7 +3985,7 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap, int& errors, int& fixed) // traverse in reverse order. sobject_t head; SnapSet snapset; - unsigned curclone = 0; + vector::reverse_iterator curclone; pg_stat_t stat; @@ -4021,7 +4021,7 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap, int& errors, int& fixed) if (snapset.clones.empty()) head = sobject_t(); // no clones. else { - curclone = snapset.clones.size()-1; + curclone = snapset.clones.rbegin(); head = p->first; } @@ -4071,15 +4071,15 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap, int& errors, int& fixed) stat.num_object_clones++; - assert(soid.snap == snapset.clones[curclone]); + assert(soid.snap == *curclone); - assert(p->second.size == snapset.clone_size[curclone]); + assert(p->second.size == snapset.clone_size[*curclone]); // verify overlap? // ... // what's next? - if (curclone == 0) + if (curclone == snapset.clones.rend()) head = sobject_t(); else curclone--;