Re: [HACKERS] Possible race in UnlockBuffers() and UnpinBuffer()

2006-04-14 Thread Tom Lane
"Qingqing Zhou" <[EMAIL PROTECTED]> writes: > "Tom Lane" <[EMAIL PROTECTED]> wrote >> "Qingqing Zhou" <[EMAIL PROTECTED]> writes: >>> After this, the proc->sem will be bumped to 1 unexpectedly ... Since >>> this problem is rare, a possible fix is to put a critical section >>> around line 1 to 7 and

Re: [HACKERS] Possible race in UnlockBuffers() and UnpinBuffer()

2006-04-14 Thread Qingqing Zhou
"Tom Lane" <[EMAIL PROTECTED]> wrote > "Qingqing Zhou" <[EMAIL PROTECTED]> writes: > > After this, the proc->sem will be bumped to 1 unexpectedly ... Since this > > problem is rare, a possible fix is to put a critical section around line 1 > > to 7 and remove UnlockBuffers() accordingly. > > No, t

Re: [HACKERS] Possible race in UnlockBuffers() and UnpinBuffer()

2006-04-13 Thread Tom Lane
"Qingqing Zhou" <[EMAIL PROTECTED]> writes: > ... However, a possible execution sequence involving another process > doing UnpinBuffer() may look like this: > unpinner: lockHdr(); read and reset flag; unlockHdr(); > waiter: lockHdr(); reset flag; unlockHdr(); ProcCancelWaitForSignal(); > unpinner

[HACKERS] Possible race in UnlockBuffers() and UnpinBuffer()

2006-04-13 Thread Qingqing Zhou
We have a wait-pin-to-1 mechanism in LockBufferForCleanup() like this: 1: bufHdr->wait_backend_pid = MyProcPid; 2: bufHdr->flags |= BM_PIN_COUNT_WAITER; 3: PinCountWaitBuf = bufHdr; 4: UnlockBufHdr_NoHoldoff(bufHdr); 5: LockBuffer(buffer, BUFFER_LOCK_UNLOCK); 6: /* Wa