postgresql/src/backend/storage
Tom Lane 130beba36d 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:10 -04:00
..
buffer Remove dubious micro-optimization in ckpt_buforder_comparator(). 2018-01-10 15:50:54 -05:00
file Fix memory leak in BufFileCreateShared(). 2018-06-16 14:21:08 +09:00
freespace Fix inadequate buffer locking in FSM and VM page re-initialization. 2018-07-13 11:53:10 -04:00
ipc Reset shmem_exit_inprogress after shmem_exit() 2018-07-12 20:22:17 +02:00
large_object Update copyright for 2018 2018-01-02 23:30:12 -05:00
lmgr Re-think predicate locking on GIN indexes. 2018-05-04 11:27:50 +03:00
page Revert "Allow on-line enabling and disabling of data checksums" 2018-04-09 19:03:42 +02:00
smgr Improve the performance of relation deletes during recovery. 2018-07-05 02:23:46 +09:00
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00