]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ring: do not realign ring contents on resize
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Feb 2023 14:36:03 +0000 (15:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Feb 2023 08:26:30 +0000 (09:26 +0100)
If a ring is resized, we must not zero its head since the contents
are preserved in-situ. Till now it used to work because we only resize
during boot and we emit very few data (if at all) during boot. But this
can change in the future.

This can be backported to 2.2 though no older version should notice a
difference.

src/ring.c

index 22ac3047504ea4ecb16e69b88e3c7bed363667ae..ae7438b3670d945bedab685069b551c0fa59bda5 100644 (file)
@@ -142,7 +142,6 @@ struct ring *ring_resize(struct ring *ring, size_t size)
                b_getblk(&ring->buf, area, ring->buf.data, 0);
                area = HA_ATOMIC_XCHG(&ring->buf.area, area);
                ring->buf.size = size;
-               ring->buf.head = 0;
        }
 
        HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);