pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM
Date: 2007-07-02 20:12:27
Message-ID: 20070702201227.0671C9FB84C@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Fix failure to restart Postgres when Linux kernel returns EIDRM for shmctl().

This is a Linux kernel bug that apparently exists in every extant kernel
version: sometimes shmctl() will fail with EIDRM when EINVAL is correct.
We were assuming that EIDRM indicates a possible conflict with pre-existing
backends, and refusing to start the postmaster when this happens. Fortunately,
there does not seem to be any case where Linux can legitimately return EIDRM
(it doesn't track shmem segments in a way that would allow that), so we can
get away with just assuming that EIDRM means EINVAL on this platform.

Per reports from Michael Fuhr and Jon Lapham --- it's a bit surprising
we have not seen more reports, actually.

Tags:
----
REL7_3_STABLE

Modified Files:
--------------
pgsql/src/backend/port:
sysv_shmem.c (r1.4.2.1 -> r1.4.2.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/sysv_shmem.c.diff?r1=1.4.2.1&r2=1.4.2.2)
pgsql/src/include/port:
linux.h (r1.31.4.2 -> r1.31.4.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/port/linux.h.diff?r1=1.31.4.2&r2=1.31.4.3)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Gregory Stark 2007-07-02 20:45:14 Re: [COMMITTERS] pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM
Previous Message Tom Lane 2007-07-02 20:12:21 pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-07-02 20:40:11 Re: SOLVED: unexpected EIDRM on Linux
Previous Message Greta L. Bonner 2007-07-02 19:00:49 dragon pavement