Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Feb 2012 15:24:02 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Guy Helmer <ghelmer@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r231087 - head/lib/libutil
Message-ID:  <20120206142402.GG1324@garage.freebsd.pl>
In-Reply-To: <201202061411.q16EBOwt039268@svn.freebsd.org>
References:  <201202061411.q16EBOwt039268@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--UTZ8bGhNySVQ9LYl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Feb 06, 2012 at 02:11:24PM +0000, Guy Helmer wrote:
> Author: ghelmer
> Date: Mon Feb  6 14:11:24 2012
> New Revision: 231087
> URL: http://svn.freebsd.org/changeset/base/231087
>=20
> Log:
>   Using the O_CLOEXEC flag on open(2) caused the pidfile lock to be lost
>   when the child process execs daemon's target program thanks to flock(2)
>   semantics. So, we apparently have to leak the open pidfile's file
>   descriptor to keep the lock for the pidfile(3) functions to work proper=
ly.
>
>   Test case demonstrated by trociny:
>  =20
>   ref8-amd64:/home/trociny% uname -r
>   8.2-STABLE
>   ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10
>   ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10
>   daemon: process already running, pid: 19799
>  =20
>   kopusha:~% uname -r
>   10.0-CURRENT
>   kopusha:~% daemon -p /tmp/sleep.pid sleep 10
>   kopusha:~% daemon -p /tmp/sleep.pid sleep 10
>   kopusha:~%

Not sure if you saw the following discussion, but O_CLOEXEC is ok here.
Mikolaj is working on improving daemon to handle it properly.

What we had in 8.2-STABLE is also incorrect, but for other reasons.

All in all, O_CLOEXEC should stay. What Mikolaj presented is a problem
in daemon(8) and not pidfile(3).

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

--UTZ8bGhNySVQ9LYl
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk8v4oIACgkQForvXbEpPzSRMQCfc5oRcV8KhB8d2JJLul7mbJoG
Zq8AoJ39wwZRPVWUydlDyiA1QC4QrBVX
=No2B
-----END PGP SIGNATURE-----

--UTZ8bGhNySVQ9LYl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120206142402.GG1324>