From 9f3aebee16e256888b149fa770df845787b06b6e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 22 Sep 2015 13:57:37 -0400 Subject: [PATCH] osd: fix requeue of replay requests during activating If the replay period expires while we are still in the activating state, we can simply insert our list of requests at the front of the waiting_for_active list. Fixes: #13116 Signed-off-by: Sage Weil (cherry picked from commit d18cf51d9419819cdda3782b188b010969288911) --- src/osd/OSD.cc | 6 +++--- src/osd/PG.cc | 11 ++++++++--- src/osd/PG.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0c01ba6168d..4cc9e11ffbf 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7848,11 +7848,11 @@ void OSD::check_replay_queue() PG *pg = _lookup_lock_pg_with_map_lock_held(pgid); pg_map_lock.unlock(); dout(10) << "check_replay_queue " << *pg << dendl; - if (pg->is_active() && - pg->is_replay() && + if ((pg->is_active() || pg->is_activating()) && + pg->is_replay() && pg->is_primary() && pg->replay_until == p->second) { - pg->replay_queued_ops(); + pg->replay_queued_ops(); } pg->unlock(); } else { diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7b91bf8c97d..b730aaf2f16 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1818,6 +1818,7 @@ void PG::queue_op(OpRequestRef& op) void PG::replay_queued_ops() { assert(is_replay()); + assert(is_active() || is_activating()); eversion_t c = info.last_update; list replay; dout(10) << "replay_queued_ops" << dendl; @@ -1838,9 +1839,13 @@ void PG::replay_queued_ops() replay.push_back(p->second); } replay_queue.clear(); - requeue_ops(replay); - requeue_ops(waiting_for_active); - assert(waiting_for_peered.empty()); + if (is_active()) { + requeue_ops(replay); + requeue_ops(waiting_for_active); + assert(waiting_for_peered.empty()); + } else { + waiting_for_active.splice(waiting_for_active.begin(), replay); + } publish_stats_to_osd(); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 41de9d6d14a..5e7914400e6 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2078,6 +2078,7 @@ public: int get_state() const { return state; } bool is_active() const { return state_test(PG_STATE_ACTIVE); } + bool is_activating() const { return state_test(PG_STATE_ACTIVATING); } bool is_peering() const { return state_test(PG_STATE_PEERING); } bool is_down() const { return state_test(PG_STATE_DOWN); } bool is_replay() const { return state_test(PG_STATE_REPLAY); } -- 2.47.3