diff options
author | Samuel Just <sam.just@inktank.com> | 2013-02-25 13:28:31 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-03-04 13:54:06 -0800 |
commit | a06ea30f84ae7368b7f8f9302cff3f17447c2d45 (patch) | |
tree | e8012094a677675f96eca9d0244e23c459aabe40 | |
parent | 83e9aa5038ee743d6f9eb8995bdb5ae0e87dfee2 (diff) | |
download | ceph-a06ea30f84ae7368b7f8f9302cff3f17447c2d45.tar.gz |
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 <sam.just@inktank.com>
(cherry picked from commit 62999ea2d362b32dfc86a15dcb03b06fb5cb0572)
-rw-r--r-- | src/osd/PG.cc | 4 | ||||
-rw-r--r-- | src/osd/PG.h | 4 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 6 | ||||
-rw-r--r-- | 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 a8b16da3126..6d6f8b8f390 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1750,7 +1750,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); @@ -3239,7 +3239,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 ec3d4664a90..c32f8322189 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1841,6 +1841,10 @@ public: list<Context *> *on_applied, list<Context *> *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 134a612d7bd..9e1c38fd134 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4724,7 +4724,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); @@ -4766,7 +4766,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 @@ -5799,7 +5799,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 0277e7f4b38..c6e15058b47 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -917,7 +917,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(); |