1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

LockBuffer should not elog while holding buffer's cntx_lock.

This commit is contained in:
Tom Lane
2001-01-08 18:31:49 +00:00
parent 6adc255f8a
commit e2586c3c62

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.101 2000/12/29 21:31:21 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.102 2001/01/08 18:31:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -1977,8 +1977,11 @@ LockBuffer(Buffer buffer, int mode)
*buflock &= ~BL_W_LOCK; *buflock &= ~BL_W_LOCK;
} }
else else
{
S_UNLOCK(&(buf->cntx_lock));
elog(ERROR, "UNLockBuffer: buffer %lu is not locked", buffer); elog(ERROR, "UNLockBuffer: buffer %lu is not locked", buffer);
} }
}
else if (mode == BUFFER_LOCK_SHARE) else if (mode == BUFFER_LOCK_SHARE)
{ {
unsigned i = 0; unsigned i = 0;
@ -2033,7 +2036,10 @@ LockBuffer(Buffer buffer, int mode)
} }
} }
else else
{
S_UNLOCK(&(buf->cntx_lock));
elog(ERROR, "LockBuffer: unknown lock mode %d", mode); elog(ERROR, "LockBuffer: unknown lock mode %d", mode);
}
S_UNLOCK(&(buf->cntx_lock)); S_UNLOCK(&(buf->cntx_lock));
} }
@ -2122,11 +2128,11 @@ InitBufferIO(void)
#endif #endif
/* /*
* Clean up any active buffer I/O after an error.
* This function is called from ProcReleaseSpins(). * This function is called from ProcReleaseSpins().
* BufMgrLock isn't held when this function is called. * BufMgrLock isn't held when this function is called.
* BM_IO_ERROR is always set. If BM_IO_ERROR was already *
* set in case of output,this routine would kill all * If I/O was in progress, BM_IO_ERROR is always set.
* backends and reset postmaster.
*/ */
void void
AbortBufferIO(void) AbortBufferIO(void)
@ -2142,6 +2148,7 @@ AbortBufferIO(void)
else else
{ {
Assert(buf->flags & BM_DIRTY || buf->cntxDirty); Assert(buf->flags & BM_DIRTY || buf->cntxDirty);
/* Issue notice if this is not the first failure... */
if (buf->flags & BM_IO_ERROR) if (buf->flags & BM_IO_ERROR)
{ {
elog(NOTICE, "write error may be permanent: cannot write block %u for %s/%s", elog(NOTICE, "write error may be permanent: cannot write block %u for %s/%s",