diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-14 03:38:56 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-14 03:38:56 +0000 |
commit | 0fcc3c2f1d3cc71aa8affe082568b6e033ffa429 (patch) | |
tree | 2d2188ea4df90bd0c396dd56f0d28a64c173fbb0 /src/backend/storage/buffer/bufmgr.c | |
parent | cc39aca7d4a317a66db51a2180f7fee6e76084bd (diff) | |
download | postgresql-0fcc3c2f1d3cc71aa8affe082568b6e033ffa429.tar.gz postgresql-0fcc3c2f1d3cc71aa8affe082568b6e033ffa429.zip |
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.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 38a57441059..539567fd012 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.206 2006/03/31 23:32:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.207 2006/04/14 03:38:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1726,8 +1726,6 @@ UnlockBuffers(void) if (buf) { - HOLD_INTERRUPTS(); /* don't want to die() partway through... */ - LockBufHdr(buf); /* @@ -1740,11 +1738,7 @@ UnlockBuffers(void) UnlockBufHdr(buf); - ProcCancelWaitForSignal(); - PinCountWaitBuf = NULL; - - RESUME_INTERRUPTS(); } } |