Red Hat Bugzilla – Bug 113789
/etc/rc.d/init.d/mdmonitor can be improved
Last modified: 2007-11-30 17:10:35 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Description of problem:
/etc/rc.d/init.d/mdmonitor uses a hack to start mdadm. I found that
mdadm can be started in the standard way, with daemon(), initlog etc.
So I made a patch for the init script, which maybe will help if the
errata for #112490 does not already have an improvement:
daemon --check mdadm \
"/bin/bash -c \"mdadm --monitor --scan -f > /var/run/mdadm.pid\""
mdadm in monitor mode will run in background if argument -f or
--daemonise is given.
Although mdadm(8) man page says "Also write pid of mdadm daemon to
/var/run/mdadm.", I did not see this happening. The man page also says
and this is true: in daemon mode mdadm will write the pid of the
daemon on stdout. With an extra shell invocation and a redirection I
managed to write this pid to /var/run/mdadm.pid. One possible problem:
if mdadm refuses to start or become a daemon, then /var/run/mdadm.pid
will be created as a zero size file. If this is a problem, then the
script could check the size and delete the file.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Review /etc/rc.d/init.d/mdmonitor
2. service mdmonitor start and see the odd output format.
Created attachment 97079 [details]
improvement of mdmonitor init script
We will review this... remind me in 10 days if you don't hear anything
Consider yourself reminded :-)
Took a quick look. The FC2 initscript changed a bit from FC1, but
aside from that I am uncertain about the behavior of the kernel side
enough to determine if removing the ugly sleep hack is safe or not. I
would recommend raising this on f-d-l.
mdmonitor initscript is really the same in FC1 and FC2 test2, probably
you looked at the new mdmpd initscript. The comment before the sleep
says that it's there to give mdadm a chance to start and decide if it
should die due to some errors or continue to run in monitor mode.
This should show up in the 1.5.0-4 version of the package.