pgsql: aio: Be more paranoid about interrupts

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: aio: Be more paranoid about interrupts
Date: 2025-03-26 20:34:13
Message-ID: E1txXS1-0019E2-2n@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)leadboat(dot)com>
Reported-by: Noah Misch <noah(at)leadboat(dot)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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-03-26 23:08:47 pgsql: doc: Mention possible ephemeral discrepancies in pg_stat_activit
Previous Message Robert Haas 2025-03-26 19:55:12 pgsql: pg_overexplain: SET jit=off when running tests.