Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2005 08:16:45 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Poul-Henning Kamp <phk@haven.freebsd.dk>
Cc:        Alexander Leidinger <Alexander@Leidinger.net>, Robert Watson <rwatson@freebsd.org>, arch@freebsd.org
Subject:   Re: [CFR] reflect resolv.conf update to running application
Message-ID:  <20050822151645.GB22948@odin.ac.hmc.edu>
In-Reply-To: <58449.1124644626@phk.freebsd.dk>
References:  <20050821115454.55441a64@Magellan.Leidinger.net> <58449.1124644626@phk.freebsd.dk>

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

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

On Sun, Aug 21, 2005 at 07:17:06PM +0200, Poul-Henning Kamp wrote:
> In message <20050821115454.55441a64@Magellan.Leidinger.net>, Alexander Le=
idinger writes:
> >On Sun, 21 Aug 2005 00:37:56 +0100 (BST)
> >Robert Watson <rwatson@freebsd.org> wrote:
> >
> >> (2) By reading the configuration file more frequently and more quickly
> >>      after a change, we increase the chances of a race condition in wh=
ich
> >>      the resolve reads a partially written resolv.conf file during an
> >>      update.  Does this happen in practice?  I've always been very lee=
ry of
> >>      re-reading configuration files automatically based on a time-stam=
p, as
> >>      updates to files are not atomic at all.
> >
> >Can kqueue be used instead of polling?
>=20
> Programs writing resolv.conf should just this the right way:
>=20
> 	1. Write new contents to temorary file.
> 	2. Rename temporary file to resolv.conf.

The one issue with this is that we sortof support a read-only /etc with
resolv.conf as a symlink to somewhere else.  Short of following the
symlink by hand in dhclient-script, you have to do the current cat
trick.  It should cause the file to be replaced in one write() though so
I don't think the race exists (unless someone comes up with a dhclient
config that generates a resolv.conf larger then 512-bytes).

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--8GpibOaaTibBMecb
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDCexcXY6L6fI4GtQRAnwpAKCppisI64Yt7wN2AlCC3V13GguoQQCgg2se
+exN5BjjU6bSp+PppwuYHGE=
=U4Lu
-----END PGP SIGNATURE-----

--8GpibOaaTibBMecb--



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