From 3e44dc16ed3fbda053996e44826aa3d90042a234 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 1 Apr 2015 16:25:22 -0700 Subject: [PATCH] ReplicatedPG::finish_promote: fix snap promote head snaps 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 (cherry picked from commit a45a698372def1623323470c6a1c4eb70e0bb79f) --- src/osd/ReplicatedPG.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ce7a5dfb1f0d0..3285163aa1e29 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -6642,11 +6642,10 @@ void ReplicatedPG::finish_promote(int r, CopyResults *results, vector::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());