Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group