From 0fcc3c2f1d3cc71aa8affe082568b6e033ffa429 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 14 Apr 2006 03:38:56 +0000 Subject: 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. --- src/backend/storage/buffer/bufmgr.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/backend/storage/buffer/bufmgr.c') 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(); } } -- cgit v1.2.3