pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM
Date
Msg-id 20070702201212.0AD419FB682@postgresql.org
Whole thread Raw
List pgsql-committers
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:
----
REL8_0_STABLE

Modified Files:
--------------
    pgsql/src/backend/port:
        sysv_shmem.c (r1.42 -> r1.42.4.1)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/sysv_shmem.c.diff?r1=1.42&r2=1.42.4.1)
    pgsql/src/include/port:
        linux.h (r1.40 -> r1.40.4.1)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/port/linux.h.diff?r1=1.40&r2=1.40.4.1)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix failure to restart Postgres when Linux kernel returns EIDRM