Repair a low-probability race condition identified by Qingqing Zhou.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 0fcc3c2f1d3cc71aa8affe082568b6e033ffa429
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2006-04-14T03:38:56Z
Releases: 8.2.0
Repair a low-probability race condition identified by Qingqing Zhou.
If a process abandons a wait in LockBufferForCleanup (in practice,
only happens if someone cancels a VACUUM) just before someone else
sends it a signal indicating the buffer is available, it was possible
for the wakeup to remain in the process' semaphore, causing misbehavior
next time the process waited for an lmgr lock.  Rather than try to
prevent the race condition directly, it seems best to make the lock
manager robust against leftover wakeups, by having it repeat waiting
on the semaphore if the lock has not actually been granted or denied
yet.

Files

PathChange+/−
src/backend/storage/buffer/bufmgr.c modified +1 −7
src/backend/storage/lmgr/lock.c modified +9 −5
src/backend/storage/lmgr/proc.c modified +30 −37
src/include/c.h modified +2 −1
src/include/storage/proc.h modified +2 −3