From 5eaa8cd6f836e4794815c128499b062c0308a7cb Mon Sep 17 00:00:00 2001 From: David Zafman Date: Wed, 9 May 2018 17:32:39 -0700 Subject: [PATCH] osd: Don't evict even when preemption has restarted with smaller chunk Fixes: https://tracker.ceph.com/issues/24045 Signed-off-by: David Zafman (cherry picked from commit 818b59fa95ee60e86991276f18c4dee405dc79b1) Conflicts: src/osd/PG.h (trivial) --- src/osd/PG.cc | 15 +++++++++++---- src/osd/PG.h | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 715b95690bb7c..5877a32280df7 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4406,6 +4406,7 @@ void PG::replica_scrub( scrubber.replica_scrub_start = msg->min_epoch; scrubber.start = msg->start; scrubber.end = msg->end; + scrubber.max_end = msg->end; scrubber.deep = msg->deep; scrubber.epoch_start = info.history.same_interval_since; if (msg->priority) { @@ -4597,7 +4598,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) while (!done) { dout(20) << "scrub state " << Scrubber::state_string(scrubber.state) - << " [" << scrubber.start << "," << scrubber.end << ")" << dendl; + << " [" << scrubber.start << "," << scrubber.end << ")" + << " max_end " << scrubber.max_end << dendl; switch (scrubber.state) { case PG::Scrubber::INACTIVE: @@ -4717,6 +4719,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) break; } scrubber.end = candidate_end; + if (scrubber.end > scrubber.max_end) + scrubber.max_end = scrubber.end; } // walk the log to find the latest update that affects our chunk @@ -4948,6 +4952,7 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) scrubber.replica_scrubmap_pos = ScrubMapBuilder(); scrubber.start = hobject_t(); scrubber.end = hobject_t(); + scrubber.max_end = hobject_t(); done = true; break; @@ -4956,7 +4961,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) } } dout(20) << "scrub final state " << Scrubber::state_string(scrubber.state) - << " [" << scrubber.start << "," << scrubber.end << ")" << dendl; + << " [" << scrubber.start << "," << scrubber.end << ")" + << " max_end " << scrubber.max_end << dendl; } bool PG::write_blocked_by_scrub(const hobject_t& soid) @@ -4978,8 +4984,8 @@ bool PG::write_blocked_by_scrub(const hobject_t& soid) bool PG::range_intersects_scrub(const hobject_t &start, const hobject_t& end) { - // does [start, end] intersect [scrubber.start, scrubber.end) - return (start < scrubber.end && + // does [start, end] intersect [scrubber.start, scrubber.max_end) + return (start < scrubber.max_end && end >= scrubber.start); } @@ -7645,6 +7651,7 @@ boost::statechart::result PG::RecoveryState::Active::react(const QueryState& q) q.f->dump_string("scrubber.state", Scrubber::state_string(pg->scrubber.state)); q.f->dump_stream("scrubber.start") << pg->scrubber.start; q.f->dump_stream("scrubber.end") << pg->scrubber.end; + q.f->dump_stream("scrubber.max_end") << pg->scrubber.max_end; q.f->dump_stream("scrubber.subset_last_update") << pg->scrubber.subset_last_update; q.f->dump_bool("scrubber.deep", pg->scrubber.deep); { diff --git a/src/osd/PG.h b/src/osd/PG.h index a877f86e98ae3..e4b1012345f60 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1277,7 +1277,8 @@ public: int num_digest_updates_pending; // chunky scrub - hobject_t start, end; + hobject_t start, end; // [start,end) + hobject_t max_end; // Largest end that may have been sent to replicas eversion_t subset_last_update; // chunky scrub state @@ -1353,6 +1354,7 @@ public: state = PG::Scrubber::INACTIVE; start = hobject_t(); end = hobject_t(); + max_end = hobject_t(); subset_last_update = eversion_t(); shallow_errors = 0; deep_errors = 0; -- 2.39.5