pgsql: Fix stale-pointer problem in fast-path locking logic.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix stale-pointer problem in fast-path locking logic.
Дата
Msg-id E1VloFU-0004LJ-Gf@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix stale-pointer problem in fast-path locking logic.

When acquiring a lock in fast-path mode, we must reset the locallock
object's lock and proclock fields to NULL.  They are not necessarily that
way to start with, because the locallock could be left over from a failed
lock acquisition attempt earlier in the transaction.  Failure to do this
led to all sorts of interesting misbehaviors when LockRelease tried to
clean up no-longer-related lock and proclock objects in shared memory.
Per report from Dan Wood.

In passing, modify LockRelease to elog not just Assert if it doesn't find
lock and proclock objects for a formerly fast-path lock, matching the code
in FastPathGetRelationLockEntry and LockRefindAndRelease.  This isn't a
bug but it will help in diagnosing any future bugs in this area.

Also, modify FastPathTransferRelationLocks and FastPathGetRelationLockEntry
to break out of their loops over the fastpath array once they've found the
sole matching entry.  This was inconsistently done in some search loops
and not others.

Improve assorted related comments, too.

Back-patch to 9.2 where the fast-path mechanism was introduced.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/024edb4543d4159c587e71fff3d6ab6a85a10beb

Modified Files
--------------
src/backend/storage/lmgr/lock.c |   83 ++++++++++++++++++++++++++-------------
src/include/storage/lock.h      |   20 ++++++++--
2 files changed, 73 insertions(+), 30 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: pgsql: Minor correction of READ COMMITTED isolation level docs.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix stale-pointer problem in fast-path locking logic.