| From: | Andres Freund <andres(at)anarazel(dot)de> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: bufmgr: Fix order of operations in UnlockBufHdrExt |
| Date: | 2026-07-10 17:27:09 |
| Message-ID: | E1wiF0H-000TfF-0A@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
bufmgr: Fix order of operations in UnlockBufHdrExt
In c75ebc657ffc I (Andres) introduced UnlockBufHdrExt() which can set and
clear bits in the buffer state using CAS. Unfortunately I added bits before
subtracting them, which means that a bit that was both removed and set would
remain unset. Fix the order of operations.
The only known case where that is a problem is that BM_IO_ERROR would not
actually remain set.
It's unfortunately not trivial to add a decent, race-free, test to verify that
BM_IO_ERROR remains set. That's therefore left for the 20 cycle.
Reported-by: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Discussion: https://postgr.es/m/ab0dcc9e-aba0-44e3-ac23-8d74c48888e6@postgrespro.ru
Backpatch-through: 19, where c75ebc657ffc went in
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c787c952bc882626c66ec64b1d35a664902bfa8b
Modified Files
--------------
src/include/storage/buf_internals.h | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Melanie Plageman | 2026-07-10 22:21:27 | pgsql: Update FSM after updating VM on-access |
| Previous Message | Thom Brown | 2026-07-10 15:54:14 | Re: pgsql: SQL Property Graph Queries (SQL/PGQ) |