pgsql: aio: Be more paranoid about interrupts - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: aio: Be more paranoid about interrupts
Date
Msg-id E1txXS1-0019E2-2n@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
aio: Be more paranoid about interrupts

As reported by Noah, it's possible, although practically very unlikely, that
interrupts could be processed in between pgaio_io_reopen() and
pgaio_io_perform_synchronously(). Prevent that by explicitly holding
interrupts.

It also seems good to add an assertion to pgaio_io_before_prep() to ensure
that interrupts are held, as otherwise FDs referenced by the IO could be
closed during interrupt processing. All code in the aio series currently runs
the code with interrupts held, but it seems better to be paranoid.

Reviewed-by: Noah Misch <noah@leadboat.com>
Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20250324002939.5c.nmisch@google.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/96da9050a57aece4a48ab34a84bc3b3412708a20

Modified Files
--------------
src/backend/storage/aio/aio_io.c        | 6 ++++++
src/backend/storage/aio/method_worker.c | 9 +++++++++
2 files changed, 15 insertions(+)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: pg_overexplain: SET jit=off when running tests.
Next
From: Michael Paquier
Date:
Subject: pgsql: doc: Mention possible ephemeral discrepancies in pg_stat_activit