Fix spinlock usage in UnpinBuffer()

From: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-patches(at)postgresql(dot)org
Subject: Fix spinlock usage in UnpinBuffer()
Date: 2005-12-28 19:09:28
Message-ID: Pine.LNX.4.58.0512281404380.31081@eon.cs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


There is no LWLock protecting the spinlock in UnpinBuffer(), so we need do
so ourselves. I also checked other NoHoldOff spinlock, seems they are ok.

Regards,
Qingqing

Index: bufmgr.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v
retrieving revision 1.200
diff -c -r1.200 bufmgr.c
*** bufmgr.c 22 Nov 2005 18:17:19 -0000 1.200
--- bufmgr.c 28 Dec 2005 09:33:18 -0000
***************
*** 812,817 ****
--- 812,818 ----
Assert(!LWLockHeldByMe(buf->io_in_progress_lock));

/* NoHoldoff ensures we don't lose control before sending signal */
+ HOLD_INTERRUPTS();
LockBufHdr_NoHoldoff(buf);

/* Decrement the shared reference count */
***************
*** 847,852 ****
--- 848,856 ----
else
UnlockBufHdr_NoHoldoff(buf);

+ /* safe to accept interrupts now */
+ RESUME_INTERRUPTS();
+
/*
* If VACUUM is releasing an otherwise-unused buffer, send it to the
* freelist for near-term reuse. We put it at the tail so that it

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-12-28 19:56:29 Re: Fix spinlock usage in UnpinBuffer()
Previous Message Pavel Stehule 2005-12-28 05:20:11 Re: sending mail from Postgres