From c6f9a4069bb32f0a4fae475c2b5f593f01b45c14 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 19 Feb 2019 09:31:50 -0600 Subject: [PATCH] osd/PG: align past_intervals and last_epoch_clean for fabricated merge target Fix fix from b79442efce479fde7f8bda8fdadf86e91003a327. We need to use last_epoch_clean *after* we set it when comparing it to the past_intervals. Fixes: http://tracker.ceph.com/issues/37511 Fixes: http://tracker.ceph.com/issues/24866 Signed-off-by: Sage Weil --- src/osd/PG.cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 846790040e0..b2e1b89dec5 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2779,17 +2779,6 @@ void PG::merge_from(map& sources, RecoveryCtx *rctx, // remapped in concert with each other... info.history = sources.begin()->second->info.history; - // if the past_intervals start is later than last_epoch_clean, it implies - // the source repeered again but the target didn't. avoid the discrepancy - // but adjusting the interval start backwards to match. - auto pib = past_intervals.get_bounds(); - if (info.history.last_epoch_clean < pib.first) { - dout(10) << __func__ << " last_epoch_clean " - << info.history.last_epoch_clean << " < past_interval start " - << pib.first << ", adjusting start backwards" << dendl; - past_intervals.adjust_start_backwards(info.history.last_epoch_clean); - } - // we use the pg_num_dec_last_epoch_clean we got from the caller, which is // the epoch that was clean according to the target pg whe it requested // the mon decrement pg_num. @@ -2805,6 +2794,20 @@ void PG::merge_from(map& sources, RecoveryCtx *rctx, << " from pool last_dec_*, source pg history was " << sources.begin()->second->info.history << dendl; + + // if the past_intervals start is later than last_epoch_clean, it + // implies the source repeered again but the target didn't, or + // that the source became clean in a later epoch than the target. + // avoid the discrepancy but adjusting the interval start + // backwards to match so that check_past_interval_bounds() will + // not complain. + auto pib = past_intervals.get_bounds(); + if (info.history.last_epoch_clean < pib.first) { + dout(10) << __func__ << " last_epoch_clean " + << info.history.last_epoch_clean << " < past_interval start " + << pib.first << ", adjusting start backwards" << dendl; + past_intervals.adjust_start_backwards(info.history.last_epoch_clean); + } } dirty_info = true; -- 2.39.5