summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2016-05-30 22:35:53 +0000
committerAndres Freund2016-05-30 22:35:53 +0000
commit87a3023c60f4bab551441492652ef19371847fd3 (patch)
treeaa3e48e51f4fae1351696d223651402323272eba
parent975ad4e602ff5793f2e57cfc883780dd5ff645a0 (diff)
Move memory barrier in UnlockBufHdr to before releasing the lock.
This bug appears to have been introduced late in the development of 48354581a4 ("Allow Pin/UnpinBuffer to operate in a lockfree manner."). Found while debugging a bug which turned out to be independent of the commit mentioned above. Backpatch: -
-rw-r--r--src/include/storage/buf_internals.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index c9cae956a5..511d7409e6 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -242,8 +242,8 @@ extern PGDLLIMPORT LWLockMinimallyPadded *BufferIOLWLockArray;
extern uint32 LockBufHdr(BufferDesc *desc);
#define UnlockBufHdr(desc, s) \
do { \
- pg_atomic_write_u32(&(desc)->state, (s) & (~BM_LOCKED)); \
pg_write_barrier(); \
+ pg_atomic_write_u32(&(desc)->state, (s) & (~BM_LOCKED)); \
} while (0)