pgsql: Don't let protected variable access to be reordered after spinlo

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Don't let protected variable access to be reordered after spinlo
Date: 2014-10-14 07:14:31
Message-ID: E1XdwJT-0004sm-Uv@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4971c36b46c63c0b36a38df6a4b6ad9f303e4620

Modified Files
--------------
src/backend/storage/lmgr/lwlock.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2014-10-14 18:20:20 pgsql: pg_dump: Reduce use of global variables
Previous Message Heikki Linnakangas 2014-10-14 06:52:57 pgsql: Fix typo in docs.