pgsql: Fix deadlock danger when atomic ops are done under spinlock.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Fix deadlock danger when atomic ops are done under spinlock.
Дата
Msg-id E1jm2Cq-0006WJ-UW@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix deadlock danger when atomic ops are done under spinlock.

This was a danger only for --disable-spinlocks in combination with
atomic operations unsupported by the current platform.

While atomics.c was careful to signal that a separate semaphore ought
to be used when spinlock emulation is active, spin.c didn't actually
implement that mechanism. That's my (Andres') fault, it seems to have
gotten lost during the development of the atomic operations support.

Fix that issue and add test for nesting atomic operations inside a
spinlock.

Author: Andres Freund
Discussion: https://postgr.es/m/20200605023302.g6v3ydozy5txifji@alap3.anarazel.de
Backpatch: 9.5-

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/825d89dda5add2eecdc26fa36365720b22c72b71

Modified Files
--------------
src/backend/storage/lmgr/spin.c | 97 ++++++++++++++++++++++++++++-------------
src/test/regress/regress.c      | 52 ++++++++++++++++++++++
2 files changed, 119 insertions(+), 30 deletions(-)


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: pgsql: Add basic spinlock tests to regression tests.
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Fix deadlock danger when atomic ops are done under spinlock.