Avoid infinite loop in InvalidateBuffer if we ourselves are holding
authorTom Lane <[email protected]>
Fri, 18 Mar 2005 05:25:23 +0000 (05:25 +0000)
committerTom Lane <[email protected]>
Fri, 18 Mar 2005 05:25:23 +0000 (05:25 +0000)
a pin on the victim buffer.

src/backend/storage/buffer/bufmgr.c

index 59dec8f9ead1da0b9896a93c14e777f60f306a19..bda4544b279c733d1f418dfce5212ca512182f82 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.186 2005/03/04 20:21:06 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.187 2005/03/18 05:25:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -551,6 +551,9 @@ retry:
        {
                UnlockBufHdr_NoHoldoff(buf);
                LWLockRelease(BufMappingLock);
+               /* safety check: should definitely not be our *own* pin */
+               if (PrivateRefCount[buf->buf_id] != 0)
+                       elog(ERROR, "buffer is pinned in InvalidateBuffer");
                WaitIO(buf);
                goto retry;
        }