postgresql/src/backend
Tom Lane 5d195dc40a Be more careful about barriers when releasing BackgroundWorkerSlots.
ForgetBackgroundWorker lacked any memory barrier at all, while
BackgroundWorkerStateChange had one but unaccountably did
additional manipulation of the slot after the barrier.  AFAICS,
the rule must be that the barrier is immediately before setting
or clearing slot->in_use.

It looks like back in 9.6 when ForgetBackgroundWorker was first
written, there might have been some case for not needing a
barrier there, but I'm not very convinced of that --- the fact
that the load of bgw_notify_pid is in the caller doesn't seem
to guarantee no memory ordering problem.  So patch 9.6 too.

It's likely that this doesn't fix any observable bug on Intel
hardware, but machines with weaker memory ordering rules could
have problems here.

Discussion: https://postgr.es/m/4046084.1620244003@sss.pgh.pa.us
2021-05-15 12:21:06 -04:00
..
access Prevent infinite insertion loops in spgdoinsert(). 2021-05-14 15:07:34 -04:00
bootstrap Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:15 -07:00
catalog Fix use-after-release issue with pg_identify_object_as_address() 2021-04-28 11:59:00 +09:00
commands Fix some inappropriately-disallowed uses of ALTER ROLE/DATABASE SET. 2021-04-13 15:10:18 -04:00
executor Fix mishandling of resjunk columns in ON CONFLICT ... UPDATE tlists. 2021-05-10 11:02:30 -04:00
foreign Remove GetUserMappingId() and GetUserMappingById(). 2016-07-22 11:32:23 -04:00
lib Revert "Permit dump/reload of not-too-large >1GB tuples" 2016-12-06 12:46:03 -03:00
libpq In the postmaster, rely on the signal infrastructure to block signals. 2020-10-15 12:50:57 -04:00
main Install Windows crash dump handler before all else. 2017-11-12 14:31:04 -08:00
nodes Ensure that expandTableLikeClause() re-examines the same table. 2020-12-01 14:02:28 -05:00
optimizer Silence another gcc 11 warning. 2021-01-28 17:18:48 -05:00
parser Fix old bug with coercing the result of a COLLATE expression. 2021-04-12 14:37:22 -04:00
po Translation updates 2021-05-10 14:24:16 +02:00
port Fix race condition in our Windows signal emulation. 2019-12-09 15:03:52 -05:00
postmaster Be more careful about barriers when releasing BackgroundWorkerSlots. 2021-05-15 12:21:06 -04:00
regex Fix another ancient bug in parsing of BRE-mode regular expressions. 2021-02-18 22:38:55 -05:00
replication Fix memory leak in SnapBuildSerialize. 2021-01-13 09:12:59 +05:30
rewrite Revert "Propagate CTE property flags when copying a CTE list into a rule." 2021-02-07 12:54:08 -05:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Shut down transaction tracking at startup process exit. 2021-04-06 02:27:48 +09:00
tcop Refactor CHECK_FOR_INTERRUPTS() to add flexibility. 2021-05-14 12:54:26 -04:00
tsearch Don't leak compiled regex(es) when an ispell cache entry is dropped. 2021-03-18 21:44:43 -04:00
utils Prevent integer overflows in array subscripting calculations. 2021-05-10 10:44:38 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
nls.mk Translation updates 2018-08-06 19:44:29 +02:00