]> granicus.if.org Git - postgresql/commit
Don't let protected variable access to be reordered after spinlock release.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 14 Oct 2014 07:01:00 +0000 (10:01 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 14 Oct 2014 07:05:17 +0000 (10:05 +0300)
commit4971c36b46c63c0b36a38df6a4b6ad9f303e4620
treeb8b3fd20e587eec060ee2498f275d713819d6977
parent4dbc7606cfc8188646a2e302ef5e6a5ec3c962af
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.
src/backend/storage/lmgr/lwlock.c