]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEBUG: pools: make pool_check_pattern() take a pointer to the pool
authorWilly Tarreau <w@1wt.eu>
Mon, 11 Sep 2023 09:26:12 +0000 (11:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 Sep 2023 13:19:49 +0000 (15:19 +0200)
This will be useful to report detailed bug traces.

include/haproxy/pool.h
src/pool.c

index 98b832acf17ad1ea4e3879018a416cf9f2973ec9..506e436265386e5b406efafd23fd11b6f920de4c 100644 (file)
@@ -132,7 +132,7 @@ void pool_evict_from_local_cache(struct pool_head *pool, int full);
 void pool_evict_from_local_caches(void);
 void pool_put_to_cache(struct pool_head *pool, void *ptr, const void *caller);
 void pool_fill_pattern(struct pool_cache_head *pch, struct pool_cache_item *item, uint size);
-void pool_check_pattern(struct pool_cache_head *pch, struct pool_cache_item *item, uint size, const void *caller);
+void pool_check_pattern(struct pool_cache_head *pch, struct pool_head *pool, struct pool_cache_item *item, const void *caller);
 void pool_refill_local_from_shared(struct pool_head *pool, struct pool_cache_head *pch);
 void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item);
 
@@ -252,7 +252,7 @@ static inline void *pool_get_from_cache(struct pool_head *pool, const void *call
                        item = LIST_PREV(&ph->list, typeof(item), by_pool);
 
                if (pool_debugging & POOL_DBG_INTEGRITY)
-                       pool_check_pattern(ph, item, pool->size, caller);
+                       pool_check_pattern(ph, pool, item, caller);
        }
 
        BUG_ON(&item->by_pool == &ph->list);
index 243ff5d080e8ffa0aa5ef7fcae244f280bc4c1b3..13af300082f692149c13e887ccdae04783119c5c 100644 (file)
@@ -481,9 +481,10 @@ void pool_fill_pattern(struct pool_cache_head *pch, struct pool_cache_item *item
  * must have been previously initialized using pool_fill_pattern(). If any
  * corruption is detected, the function provokes an immediate crash.
  */
-void pool_check_pattern(struct pool_cache_head *pch, struct pool_cache_item *item, uint size, const void *caller)
+void pool_check_pattern(struct pool_cache_head *pch, struct pool_head *pool, struct pool_cache_item *item, const void *caller)
 {
        const ulong *ptr = (const ulong *)item;
+       uint size = pool->size;
        uint ofs;
        ulong u;
 
@@ -526,7 +527,7 @@ static void pool_evict_last_items(struct pool_head *pool, struct pool_cache_head
                item = LIST_PREV(&ph->list, typeof(item), by_pool);
                BUG_ON(&item->by_pool == &ph->list);
                if (unlikely(pool_debugging & POOL_DBG_INTEGRITY))
-                       pool_check_pattern(ph, item, pool->size, caller);
+                       pool_check_pattern(ph, pool, item, caller);
                LIST_DELETE(&item->by_pool);
                LIST_DELETE(&item->by_lru);