aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-06-11 16:43:24 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-06-11 16:43:24 +0000
commite6cba71503fa80948a050e7e0126e932855e92cc (patch)
treeba900986f16b75133bf68f63458bd7bbbc440d9e /src/backend/storage/buffer/bufmgr.c
parent8d64b56206a73ac8413ab8b4a035e62e95f6ba99 (diff)
downloadpostgresql-e6cba71503fa80948a050e7e0126e932855e92cc.tar.gz
postgresql-e6cba71503fa80948a050e7e0126e932855e92cc.zip
Add some code to Assert that when we release pin on a buffer, we are
not holding the buffer's cntx_lock or io_in_progress_lock. A recent report from Litao Wu makes me wonder whether it is ever possible for us to drop a buffer and forget to release its cntx_lock. The Assert does not fire in the regression tests, but that proves little ...
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 400fbcf1ff7..da1998a0d50 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.169 2004/05/31 20:31:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.170 2004/06/11 16:43:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -611,7 +611,12 @@ UnpinBuffer(BufferDesc *buf)
Assert(PrivateRefCount[b] > 0);
PrivateRefCount[b]--;
if (PrivateRefCount[b] == 0)
+ {
buf->refcount--;
+ /* I'd better not still hold any locks on the buffer */
+ Assert(!LWLockHeldByMe(buf->cntx_lock));
+ Assert(!LWLockHeldByMe(buf->io_in_progress_lock));
+ }
if ((buf->flags & BM_PIN_COUNT_WAITER) != 0 &&
buf->refcount == 1)