postgresql/src
Tom Lane 0cf3363c01 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
2018-07-13 11:53:17 -04:00
..
backend Fix inadequate buffer locking in FSM and VM page re-initialization. 2018-07-13 11:53:17 -04:00
bin Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
common Unlink static libraries before rebuilding them. 2015-03-01 13:06:39 -05:00
include Improve the performance of relation deletes during recovery. 2018-07-05 02:52:28 +09:00
interfaces Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
makefiles Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
pl Fix misidentification of SQL statement type in plpgsql's exec_stmt_execsql. 2018-05-25 14:31:07 -04:00
port Fix simple_prompt() to disable echo on Windows when stdin != terminal. 2018-05-23 19:04:34 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:03 -04:00
test Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
timezone Update time zone data files to tzdata release 2018e. 2018-05-09 13:56:06 -04:00
tools Clear severity 5 perlcritic warnings from vcregress.pl 2018-05-06 07:40:25 -04:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
Makefile.shlib Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00