{
{
Mutex::Locker l(agent_lock);
+
+ // By this time all ops should be cancelled
+ assert(agent_ops == 0);
+ // By this time all PGs are shutdown and dequeued
+ assert(agent_queue.empty());
+
agent_stop_flag = true;
agent_cond.Signal();
}
agent_thread.join();
-
- agent_queue.clear();
}
set_probe_targets(prior_set->probe);
}
-void PG::clear_primary_state()
+void PG::clear_primary_state(bool staying_primary)
{
dout(10) << "clear_primary_state" << dendl;
osd->recovery_wq.dequeue(this);
osd->snap_trim_wq.dequeue(this);
+
+ if (!staying_primary)
+ agent_clear();
}
/**
// reset primary state?
if (was_old_primary || is_primary())
- clear_primary_state();
+ clear_primary_state(was_old_primary && is_primary());
// pg->on_*
context< RecoveryMachine >().get_cur_transaction(),
context< RecoveryMachine >().get_on_applied_context_list(),
context< RecoveryMachine >().get_on_safe_context_list());
-
- pg->agent_clear();
}
void clear_publish_stats();
public:
- void clear_primary_state();
+ void clear_primary_state(bool stay_primary);
public:
bool is_actingbackfill(pg_shard_t osd) const {
osd->remote_reserver.cancel_reservation(info.pgid);
osd->local_reserver.cancel_reservation(info.pgid);
- clear_primary_state();
+ clear_primary_state(false); // Not staying primary
osd->remove_want_pg_temp(info.pgid.pgid);
cancel_recovery();
}
return;
}
+ assert(!deleting);
+
if (agent_state->is_idle()) {
dout(10) << __func__ << " idle, stopping" << dendl;
unlock();