]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: Fix bug in scrub when checking clone sizes
authorSamuel Just <samuelj@hq.newdream.net>
Tue, 4 Jan 2011 00:48:39 +0000 (16:48 -0800)
committerSamuel Just <samuelj@hq.newdream.net>
Tue, 4 Jan 2011 18:27:59 +0000 (10:27 -0800)
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 <samuelj@hq.newdream.net>
src/osd/ReplicatedPG.cc

index df2b756752de89541620f90f6e8bc8a4579b1183..2361543ee99fda7aac045191c148fe90462bc936 100644 (file)
@@ -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<snapid_t>::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--;