pgsql: bufmgr: Fix valgrind checking for buffers pinned in StrategyGetB

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: bufmgr: Fix valgrind checking for buffers pinned in StrategyGetB
Date: 2025-10-09 23:17:33
Message-ID: E1v6zt7-000uR1-1v@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

bufmgr: Fix valgrind checking for buffers pinned in StrategyGetBuffer()

In 5e899859287 I made StrategyGetBuffer() pin buffers with a single CAS,
instead of using PinBuffer_Locked(). Unfortunately I missed that
PinBuffer_Locked() marked the page as defined for valgrind.

Fix this oversight by centralizing the valgrind initialization into
TrackNewBufferPin(), which also allows us to reduce the number of places doing
VALGRIND_MAKE_MEM_DEFINED.

Per buildfarm animal skink and Amit Langote.

Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff
Discussion: https://postgr.es/m/CA+HiwqGKJ6nEXEPQW7EpykVsEtzxp5-up_xhtcUAkWFtATVQvQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c819d1017ddb349d92ab323d2631bc1f10bb4e86

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-10-10 00:25:29 pgsql: Remove state.tmp when failing to save a replication slot
Previous Message Michael Paquier 2025-10-09 22:20:33 pgsql: test_bitmapset: Improve random function