Date: Mon, 5 Jan 2009 17:43:38 +0000 (UTC) From: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> To: FreeBSD current mailing list <current@freebsd.org> Subject: [cfr] rc.shutdown patch Message-ID: <20090105172736.A45399@maildrop.int.zabbadoz.net>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090105172736.A45399>