From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati
Date: Fri, 13 Jul 2018 15:53:33 +0000
Message-ID: <E1fe0Nx-00024F-79@gemulon.postgresql.org> (raw)
Fix inadequate buffer locking in FSM and VM page re-initialization.
When reading an existing FSM or VM page that was found to be corrupt by the
buffer manager, the code applied PageInit() to reinitialize the page, but
did so without any locking. There is thus a hazard that two backends might
concurrently do PageInit, which in itself would still be OK, but the slower
one might then zero over subsequent data changes applied by the faster one.
Even that is unlikely to be fatal; but it's not desirable, so add locking
to prevent it.
This does not add any locking overhead in the normal code path where the
page is OK. It's not immediately obvious that that's safe, but I believe
it is, for reasons explained in the added comments.
Problem noted by R P Asim. It's been like this for a long time, so
back-patch to all supported branches.
Discussion: https://postgr.es/m/CANXE4Te4G0TGq6cr0-TvwP0H4BNiK_-hB5gHe8mF+nz0mcYfMQ@mail.gmail.com
Branch
------
REL9_3_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/0cf3363c01104cd7a0388a3e01a533f21872d011
Modified Files
--------------
src/backend/access/heap/visibilitymap.c | 21 ++++++++++++++++++++-
src/backend/storage/freespace/freespace.c | 21 ++++++++++++++++++++-
2 files changed, 40 insertions(+), 2 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati
In-Reply-To: <E1fe0Nx-00024F-79@gemulon.postgresql.org>
References: <E1fe0Nx-00024F-79@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox