Don't let protected variable access to be reordered after spinlock release.

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 4971c36b46c63c0b36a38df6a4b6ad9f303e4620
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2014-10-14T07:05:17Z
Releases: 9.4.0
Don't let protected variable access to be reordered after spinlock release.

LWLockAcquireWithVar needs to set the protected variable while holding
the spinlock. Need to use a volatile pointer to make sure it doesn't get
reordered by the compiler. The other functions that accessed the protected
variable already got this right.

9.4 only. Earlier releases didn't have this code, and in master, spinlock
release acts as a compiler barrier.

Files

PathChange+/−
src/backend/storage/lmgr/lwlock.c modified +3 −2