From owner-freebsd-current@FreeBSD.ORG Mon Jan 5 17:45:07 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 947C6106566C for ; Mon, 5 Jan 2009 17:45:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 501878FC14 for ; Mon, 5 Jan 2009 17:45:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 84ED641C67E for ; Mon, 5 Jan 2009 18:45:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id KrLMCYdZBi7n for ; Mon, 5 Jan 2009 18:45:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 2FE0041C67B; Mon, 5 Jan 2009 18:45:06 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id CE2454448DD for ; Mon, 5 Jan 2009 17:43:38 +0000 (UTC) Date: Mon, 5 Jan 2009 17:43:38 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: FreeBSD current mailing list Message-ID: <20090105172736.A45399@maildrop.int.zabbadoz.net> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: [cfr] rc.shutdown patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2009 17:45:07 -0000 Hi, while starting and stopping jails with rc.d/jail on a system that had no killall in the base (very stripped /usr/**) I found that unmounting devfs for the jail hadn't worked. Digging into this I found that rc.shutdown lets a sleep 30 (rcshutdown_timeout) hanging around for the rest of that time which is unpleasent if it could go away cleanly. I am using pkill, which is in /bin/ as well, to kill the sleep and the subshell instead of only killing the subshell and leaving the sleep hanging re-parented to init. I'd like to commit this but am a bit unsure for adding pkill dependency to such a central rc file; Though, two startup scripts seem to use it already (*ppp*) and dhclient uses 'pgrep' which is the same inode. I have a patch here: http://people.freebsd.org/~bz/20090105-03-rc-shutdown.diff ! ! Instead of killing the 'watchdog' subshell and leaving ! a sleep for the timeout, make sure all goes away cleanly. ! ! This avoids needing killall in rc.d/jail for a clean shutdown ! and generally does not leave dangling processes on shutdown that ! something else has to kill. ! Index: etc/rc.shutdown =================================================================== --- etc/rc.shutdown (revision 186775) +++ etc/rc.shutdown (working copy) @@ -98,7 +98,7 @@ # Terminate the background watchdog timer (if it is running) # if [ -n "$_rcshutdown_watchdog" ]; then - kill -TERM $_rcshutdown_watchdog >/dev/null 2>&1 + pkill -TERM -P $_rcshutdown_watchdog >/dev/null 2>&1 fi # Insert other shutdown procedures here Footnote: for jails we will want to keep the killall for other reasons (as we usually cannot trust the admin inside the jail to get a clean shutdown working). Any comments? /bz -- Bjoern A. Zeeb The greatest risk is not taking one.