]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::finish_promote: fix snap promote head snaps
authorSamuel Just <sjust@redhat.com>
Wed, 1 Apr 2015 23:25:22 +0000 (16:25 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 1 Apr 2015 23:39:25 +0000 (16:39 -0700)
If the snaps vector is: 10=[9,5,2]:[4]+head, the backing pool's snaps
vector is 3=[2]:[]+head, and we request clone 4 from the backing pool,
the backing pool will send us head with an empty results->snaps vector.
Actually, clone 4 should be trimmed, but the cache pool does not know
that.  Thus, we should construct an empty snaps vector for that clone.

PartialFix: #11296
Backport: firefly, hammer
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ReplicatedPG.cc

index cfd4ba3568730a94f1fc1f9dfe2a06fa5b9f2cb5..c8595d8f0d1aac15e7f9a95a12e3bb3124213252 100644 (file)
@@ -6628,11 +6628,10 @@ void ReplicatedPG::finish_promote(int r, CopyResults *results,
        vector<snapid_t>::iterator p = snapset.snaps.begin();
        while (p != snapset.snaps.end() && *p > soid.snap)
          ++p;
-       assert(p != snapset.snaps.end());
-       do {
+       while (p != snapset.snaps.end() && *p > results->snap_seq) {
          tctx->new_obs.oi.snaps.push_back(*p);
          ++p;
-       } while (p != snapset.snaps.end() && *p > results->snap_seq);
+       }
       }
       dout(20) << __func__ << " snaps " << tctx->new_obs.oi.snaps << dendl;
       assert(!tctx->new_obs.oi.snaps.empty());