From: jingwei_5107@qq.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13487: GetBufferFromRing code bug
Date: Sat, 04 Jul 2015 15:12:03 +0000
Message-ID: <20150704151203.1190.44251@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 13487
Logged by: will
Email address: jingwei_5107@qq.com
PostgreSQL version: 9.4.4
Operating system: It does not matter
Description:
In GetBufferFromRing method(/src/backend/storage/buffer/freelist.c),I think
the following code:
506 buf = &BufferDescriptors[bufnum - 1];
507 LockBufHdr(buf);
508 if (buf->refcount == 0 && buf->usage_count <= 1)
509 {
510 strategy->current_was_in_ring = true;
511 return buf;
512 }
513 UnlockBufHdr(buf);
should be changed to(Adding line 510):
506 buf = &BufferDescriptors[bufnum - 1];
507 LockBufHdr(buf);
508 if (buf->refcount == 0 && buf->usage_count <= 1)
509 {
510 UnlockBufHdr(buf);// add this line
511 strategy->current_was_in_ring = true;
512 return buf;
513 }
514 UnlockBufHdr(buf);
It should Unlock the buf before returning buf, after exclusively accessing
the buf's refcount&usage_count member.
Am I right? Any reply is appreciated if I'm wrong.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: jingwei_5107@qq.com
Subject: Re: BUG #13487: GetBufferFromRing code bug
In-Reply-To: <20150704151203.1190.44251@wrigleys.postgresql.org>
References: <20150704151203.1190.44251@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox