Fix spinlock usage in UnpinBuffer() - Mailing list pgsql-patches

From Qingqing Zhou
Subject Fix spinlock usage in UnpinBuffer()
Date
Msg-id Pine.LNX.4.58.0512281404380.31081@eon.cs
Whole thread Raw
Responses Re: Fix spinlock usage in UnpinBuffer()
List 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


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of
Next
From: Tom Lane
Date:
Subject: Re: Fix spinlock usage in UnpinBuffer()