From: Sage Weil Date: Fri, 2 Feb 2018 21:50:25 +0000 (-0600) Subject: osd: do not release recovery_ops_reserved on requeue X-Git-Tag: v13.1.0~390^2~86 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0766f5b40cb707cf058a8b25b1a9222e4259cd30;p=ceph.git osd: do not release recovery_ops_reserved on requeue This doesn't make sense.. although it's the same behavior as luminous. The point of the releases here is that if we drop something that is in the queue we drop the recovery_ops_reserved counter by that much. However, if something is in the queue and waiting, and we wake it back up, there is no net change to _reserved... which is only decremented when we actually dequeue something. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 303b9f405138..8cebc1276de3 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -9496,24 +9496,12 @@ int OSD::init_op_flags(OpRequestRef& op) void OSD::ShardedOpWQ::_wake_pg_slot( spg_t pgid, ShardData *sdata, - ShardData::pg_slot& slot, - unsigned *pushes_to_free) + ShardData::pg_slot& slot) { dout(20) << __func__ << " " << pgid << " to_process " << slot.to_process << " waiting " << slot.waiting << " waiting_peering " << slot.waiting_peering << dendl; - for (auto& q : slot.to_process) { - *pushes_to_free += q.get_reserved_pushes(); - } - for (auto& q : slot.waiting) { - *pushes_to_free += q.get_reserved_pushes(); - } - for (auto& q : slot.waiting_peering) { - for (auto& r : q.second) { - *pushes_to_free += r.get_reserved_pushes(); - } - } for (auto i = slot.to_process.rbegin(); i != slot.to_process.rend(); ++i) { @@ -9545,18 +9533,14 @@ void OSD::ShardedOpWQ::wake_pg_split_waiters(spg_t pgid) uint32_t shard_index = pgid.hash_to_shard(shard_list.size()); auto sdata = shard_list[shard_index]; bool queued = false; - unsigned pushes_to_free = 0; { Mutex::Locker l(sdata->sdata_op_ordering_lock); auto p = sdata->pg_slots.find(pgid); if (p != sdata->pg_slots.end()) { - _wake_pg_slot(pgid, sdata, p->second, &pushes_to_free); + _wake_pg_slot(pgid, sdata, p->second); queued = true; } } - if (pushes_to_free > 0) { - osd->service.release_reserved_pushes(pushes_to_free); - } if (queued) { sdata->sdata_lock.Lock(); sdata->sdata_cond.SignalOne(); @@ -9598,7 +9582,7 @@ void OSD::ShardedOpWQ::prune_or_wake_pg_waiters(OSDMapRef osdmap, int whoami) dout(20) << __func__ << " " << p->first << " pending_peering first epoch " << first << " <= " << osdmap->get_epoch() << ", requeueing" << dendl; - _wake_pg_slot(p->first, sdata, slot, &pushes_to_free); + _wake_pg_slot(p->first, sdata, slot); queued = true; } ++p; @@ -9864,7 +9848,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb) pg = osd->handle_pg_create_info(osdmap, create_info); if (pg) { // we created the pg! drop out and continue "normally"! - _wake_pg_slot(token, sdata, slot, &pushes_to_free); + _wake_pg_slot(token, sdata, slot); break; } dout(20) << __func__ << " ignored create on " << qi << dendl; @@ -9913,6 +9897,9 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb) _add_slot_waiter(token, slot, std::move(qi)); sdata->sdata_op_ordering_lock.Unlock(); pg->unlock(); + if (pushes_to_free) { + osd->service.release_reserved_pushes(pushes_to_free); + } return; } } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 1734e2dc15cc..544273b4154b 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1678,8 +1678,7 @@ private: /// wake any pg waiters after a PG is split void wake_pg_split_waiters(spg_t pgid); - void _wake_pg_slot(spg_t pgid, ShardData *sdata, ShardData::pg_slot& slot, - unsigned *pushes_to_free); + void _wake_pg_slot(spg_t pgid, ShardData *sdata, ShardData::pg_slot& slot); /// prime slots for splitting pgs void prime_splits(const set& pgs);