From a0b0ae00f25706e702377a915188f7e9a316272f Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 8 Feb 2016 07:45:24 -0800 Subject: [PATCH] Revert "osd: do not keep ref of old osdmap in pg" This reverts commit 8978cd6fcf40076dbd944a2938b335d26c62b8d5. Fixes: #14213 --- src/osd/PG.cc | 13 ++++++------- src/osd/PG.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index afcd3e37e38..6c249c39291 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -185,7 +185,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, _pool.id, p.shard), map_lock("PG::map_lock"), - osdmap_ref(curmap), pool(_pool), + osdmap_ref(curmap), last_persisted_osdmap_ref(curmap), pool(_pool), _lock("PG::_lock"), ref(0), #ifdef PG_DEBUG_REFS @@ -223,8 +223,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), do_sort_bitwise(false), - last_epoch(0), - last_persisted_epoch(curmap->get_epoch()) + last_epoch(0) { #ifdef PG_DEBUG_REFS osd->add_pgid(p, this); @@ -2787,7 +2786,7 @@ void PG::prepare_write_info(map *km) assert(ret == 0); if (need_update_epoch) last_epoch = get_osdmap()->get_epoch(); - last_persisted_epoch = last_epoch; + last_persisted_osdmap_ref = osdmap_ref; dirty_info = false; dirty_big_info = false; @@ -5424,15 +5423,15 @@ void PG::handle_activate_map(RecoveryCtx *rctx) dout(10) << "handle_activate_map " << dendl; ActMap evt; recovery_state.handle_event(evt, rctx); - if (osdmap_ref->get_epoch() - last_persisted_epoch > + if (osdmap_ref->get_epoch() - last_persisted_osdmap_ref->get_epoch() > cct->_conf->osd_pg_epoch_persisted_max_stale) { dout(20) << __func__ << ": Dirtying info: last_persisted is " - << last_persisted_epoch + << last_persisted_osdmap_ref->get_epoch() << " while current is " << osdmap_ref->get_epoch() << dendl; dirty_info = true; } else { dout(20) << __func__ << ": Not dirtying info: last_persisted is " - << last_persisted_epoch + << last_persisted_osdmap_ref->get_epoch() << " while current is " << osdmap_ref->get_epoch() << dendl; } if (osdmap_ref->check_new_blacklist_entries()) check_blacklisted_watchers(); diff --git a/src/osd/PG.h b/src/osd/PG.h index c5f1c12ff7a..30c002ee75e 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -206,6 +206,7 @@ protected: Mutex map_lock; list waiting_for_map; OSDMapRef osdmap_ref; + OSDMapRef last_persisted_osdmap_ref; PGPool pool; void queue_op(OpRequestRef& op); @@ -2055,7 +2056,6 @@ public: bool do_sort_bitwise; epoch_t last_epoch; - epoch_t last_persisted_epoch; public: const spg_t& get_pgid() const { return pg_id; } -- 2.47.3