From 62999ea2d362b32dfc86a15dcb03b06fb5cb0572 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 25 Feb 2013 13:28:31 -0800 Subject: [PATCH] PG,ReplicatedPG: use pg_has_reset_since to discard old async events Local async events are obsolete if the pg is deleting or if the epoch at which they were created is prior to last_peering_reset. Signed-off-by: Samuel Just --- src/osd/PG.cc | 4 ++-- src/osd/PG.h | 4 ++++ src/osd/ReplicatedPG.cc | 6 +++--- src/osd/ReplicatedPG.h | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 36266f5f2b6ba..4ff5242277b44 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1765,7 +1765,7 @@ void PG::replay_queued_ops() void PG::_activate_committed(epoch_t e) { lock(); - if (e < last_peering_reset) { + if (pg_has_reset_since(e)) { dout(10) << "_activate_committed " << e << ", that was an old interval" << dendl; } else if (is_primary()) { peer_activated.insert(osd->whoami); @@ -3254,7 +3254,7 @@ void PG::build_scrub_map(ScrubMap &map) _scan_list(map, ls, false); lock(); - if (epoch < last_peering_reset) { + if (pg_has_reset_since(epoch)) { dout(10) << "scrub pg changed, aborting" << dendl; return; } diff --git a/src/osd/PG.h b/src/osd/PG.h index ed85c4e2946e4..32e78a435a492 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1841,6 +1841,10 @@ public: list *on_applied, list *on_safe); void set_last_peering_reset(); + bool pg_has_reset_since(epoch_t e) { + assert(is_locked()); + return deleting || e < get_last_peering_reset(); + } void update_history_from_master(pg_history_t new_history); void fulfill_info(int from, const pg_query_t &query, diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index d079f1f27b8e2..220d73bd6267c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4542,7 +4542,7 @@ void ReplicatedPG::sub_op_modify_applied(RepModify *rm) rm->op->mark_event("sub_op_applied"); rm->applied = true; - if (rm->epoch_started >= last_peering_reset) { + if (!pg_has_reset_since(rm->epoch_started)) { dout(10) << "sub_op_modify_applied on " << rm << " op " << *rm->op->request << dendl; MOSDSubOp *m = (MOSDSubOp*)rm->op->request; assert(m->get_header().type == MSG_OSD_SUBOP); @@ -4584,7 +4584,7 @@ void ReplicatedPG::sub_op_modify_commit(RepModify *rm) rm->op->mark_commit_sent(); rm->committed = true; - if (rm->epoch_started >= last_peering_reset) { + if (!pg_has_reset_since(rm->epoch_started)) { // send commit. dout(10) << "sub_op_modify_commit on op " << *rm->op->request << ", sending commit to osd." << rm->ackerosd @@ -5617,7 +5617,7 @@ void ReplicatedPG::_committed_pushed_object( OpRequestRef op, epoch_t epoch, eversion_t last_complete) { lock(); - if (epoch >= last_peering_reset) { + if (!pg_has_reset_since(epoch)) { dout(10) << "_committed_pushed_object last_complete " << last_complete << " now ondisk" << dendl; last_complete_ondisk = last_complete; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 701b537c50743..aac728079bd09 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -824,7 +824,7 @@ protected: epoch_t epoch) : pg(pg), hoid(hoid), epoch(epoch) {} void finish(int) { pg->lock(); - if (epoch >= pg->last_peering_reset) { + if (!pg->pg_has_reset_since(epoch)) { pg->finish_recovery_op(hoid); } pg->unlock(); -- 2.39.5