From owner-freebsd-stable@FreeBSD.ORG Fri Feb 3 06:54:51 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3E6F1065670 for ; Fri, 3 Feb 2012 06:54:51 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta14.emeryville.ca.mail.comcast.net (qmta14.emeryville.ca.mail.comcast.net [76.96.27.212]) by mx1.freebsd.org (Postfix) with ESMTP id 88E588FC13 for ; Fri, 3 Feb 2012 06:54:51 +0000 (UTC) Received: from omta22.emeryville.ca.mail.comcast.net ([76.96.30.89]) by qmta14.emeryville.ca.mail.comcast.net with comcast id VJQC1i0021vN32cAEJuryg; Fri, 03 Feb 2012 06:54:51 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta22.emeryville.ca.mail.comcast.net with comcast id VJuq1i0031t3BNj8iJuq0Z; Fri, 03 Feb 2012 06:54:50 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id CF21D102C19; Thu, 2 Feb 2012 22:54:49 -0800 (PST) Date: Thu, 2 Feb 2012 22:54:49 -0800 From: Jeremy Chadwick To: Doug Barton Message-ID: <20120203065449.GA15534@icarus.home.lan> References: <20120202212222.e940f64c.torfinn.ingolfsen@broadpark.no> <20120202214550.GA6965@icarus.home.lan> <4F2B75C2.6090005@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F2B75C2.6090005@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Torfinn Ingolfsen , freebsd-stable@freebsd.org Subject: Re: FreeBSD 8.2-stable: devd fails to restart X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 06:54:51 -0000 On Thu, Feb 02, 2012 at 09:50:58PM -0800, Doug Barton wrote: > On 02/02/2012 13:45, Jeremy Chadwick wrote: > > On Thu, Feb 02, 2012 at 09:22:22PM +0100, Torfinn Ingolfsen wrote: > >> Hi, > >> > >> I thought this bug was fixed back in 2009? > >> root@kg-v7# uname -a > >> FreeBSD kg-v7.kg4.no 8.2-STABLE FreeBSD 8.2-STABLE #7: Sat Jul 9 23:00:31 CEST 2011 root@kg-v7.kg4.no:/usr/obj/usr/src/sys/GENERIC amd64 > >> root@kg-v7# > >> root@kg-v7# service devd status > >> devd is running as pid 555. > >> root@kg-v7# service devd restart > >> Stopping devd. > >> Starting devd. > >> devd: devd already running, pid: 555 > >> /etc/rc.d/devd: WARNING: failed to start devd > >> root@kg-v7# service devd status > >> devd is not running. > >> > >> What gives? > > > > This is probably "what gives", as it's a common problem with all sorts > > of daemons and is not specific to devd in the least: > > > > - devd is running (pid 555) > > - Admin issues "service devd restart" > > -- devd is sent SIGTERM; devd internally starts shutting down, > > but is not fully dead yet. "kill" does not block (wait) for > > processes to end, obviously > > No, but wait_for_pids() does. > > The OP's /etc is out of date. Hmm, mine dated April, for RELENG_8 tag, doesn't appear to use wait_for_pids. Is there implicit usage in it somewhere? (Probably bits of rc.subr(8) I'm not familiar with or don't remember...) #!/bin/sh # # $FreeBSD: src/etc/rc.d/devd,v 1.11.2.2 2011/04/29 20:31:52 dougb Exp $ # # PROVIDE: devd # REQUIRE: netif network_ipv6 # BEFORE: NETWORKING mountcritremote # KEYWORD: nojail shutdown . /etc/rc.subr name="devd" rcvar=`set_rcvar` command="/sbin/${name}" start_precmd=${name}_prestart stop_precmd=find_pidfile find_pidfile() { if get_pidfile_from_conf pid-file /etc/devd.conf; then pidfile="$_pidfile_from_conf" else pidfile="/var/run/${name}.pid" fi } devd_prestart () { find_pidfile # If devd is disabled, turn it off in the kernel to avoid memory leaks. if ! checkyesno ${rcvar}; then $SYSCTL hw.bus.devctl_disable=1 fi } load_rc_config $name run_rc_command "$1" -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |