From: David Zafman Date: Tue, 11 Mar 2014 02:54:57 +0000 (-0700) Subject: osd: hit_set_persist(): Verify all objects aren't degraded X-Git-Tag: v0.78~51^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1429%2Fhead;p=ceph.git osd: hit_set_persist(): Verify all objects aren't degraded Fixes: #7592 Signed-off-by: David Zafman --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a797c7b6ae2b..74be9bdafcfc 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -10298,20 +10298,40 @@ void ReplicatedPG::hit_set_persist() { dout(10) << __func__ << dendl; bufferlist bl; + unsigned max = pool.info.hit_set_count; utime_t now = ceph_clock_now(cct); RepGather *repop; hobject_t oid; time_t flush_time = 0; + // See what start is going to be used later + utime_t start = info.hit_set.current_info.begin; + if (!start) + start = hit_set_start_stamp; + + // If any archives are degraded we skip this persist request + // account for the additional entry being added below + for (unsigned num = info.hit_set.history.size() + 1; num > max; --num) { + list::iterator p = info.hit_set.history.begin(); + assert(p != info.hit_set.history.end()); + hobject_t aoid = get_hit_set_archive_object(p->begin, p->end); + + // Once we hit a degraded object just skip further trim + if (is_degraded_object(aoid)) + return; + } + oid = get_hit_set_archive_object(start, now); + // If the current object is degraded we skip this persist request + if (is_degraded_object(oid)) + return; + if (!info.hit_set.current_info.begin) info.hit_set.current_info.begin = hit_set_start_stamp; hit_set->seal(); ::encode(*hit_set, bl); info.hit_set.current_info.end = now; - oid = get_hit_set_archive_object(info.hit_set.current_info.begin, - info.hit_set.current_info.end); dout(20) << __func__ << " archive " << oid << dendl; if (agent_state) @@ -10408,7 +10428,7 @@ void ReplicatedPG::hit_set_persist() ctx->log.back().mod_desc.mark_unrollbackable(); } - hit_set_trim(repop, pool.info.hit_set_count); + hit_set_trim(repop, max); info.stats.stats.add(ctx->delta_stats, string()); @@ -10421,6 +10441,9 @@ void ReplicatedPG::hit_set_trim(RepGather *repop, unsigned max) list::iterator p = info.hit_set.history.begin(); assert(p != info.hit_set.history.end()); hobject_t oid = get_hit_set_archive_object(p->begin, p->end); + + assert(!is_degraded_object(oid)); + dout(20) << __func__ << " removing " << oid << dendl; ++repop->ctx->at_version.version; repop->ctx->log.push_back(