mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
DEBUG: pools: add extra sanity checks when picking objects from a local cache
These few checks are added to make sure we never try to pick an object from an empty list, which would have a devastating effect.
This commit is contained in:
parent
ceabc5ca8c
commit
e2830addda
@ -289,6 +289,7 @@ static inline void *pool_get_from_cache(struct pool_head *pool, const void *call
|
||||
/* allocate hottest objects first */
|
||||
item = LIST_NEXT(&ph->list, typeof(item), by_pool);
|
||||
#endif
|
||||
BUG_ON(&item->by_pool == &ph->list);
|
||||
LIST_DELETE(&item->by_pool);
|
||||
LIST_DELETE(&item->by_lru);
|
||||
|
||||
|
@ -329,6 +329,7 @@ static void pool_evict_last_items(struct pool_head *pool, struct pool_cache_head
|
||||
|
||||
while (released < count && !LIST_ISEMPTY(&ph->list)) {
|
||||
item = LIST_PREV(&ph->list, typeof(item), by_pool);
|
||||
BUG_ON(&item->by_pool == &ph->list);
|
||||
pool_check_pattern(ph, item, pool->size);
|
||||
LIST_DELETE(&item->by_pool);
|
||||
LIST_DELETE(&item->by_lru);
|
||||
@ -389,6 +390,7 @@ void pool_evict_from_local_caches()
|
||||
|
||||
do {
|
||||
item = LIST_PREV(&th_ctx->pool_lru_head, struct pool_cache_item *, by_lru);
|
||||
BUG_ON(&item->by_lru == &th_ctx->pool_lru_head);
|
||||
/* note: by definition we remove oldest objects so they also are the
|
||||
* oldest in their own pools, thus their next is the pool's head.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user