There seems to be a major problem when reading /proc/mdstat while a raid
set is being stopped. This rarely conflict will very rarely be seen, but
I have a daemon that monitors /proc/mdstat every two seconds and once in
a while the system panics when doing testing.
While running the script below which pounds on (reading) /proc/mdstat
for about a second, then backs off for a second. I got a panic after 3
start/stop cycles and it happened when doing the stop.
Also, doing this exercise, there is something else interesting. Without
the 'sleep 1', the raid driver will not resync or stop. I would think
that a window of time would eventually open up, but after about a minute
of waiting, still nothing happened.
Another thing. Reading the /proc/mdstat seems to be relatively slow. It
takes over a second to read it 100 times. Perhaps this delay is also in
the script processing.
Any comments or fixes :-) are appreciated.
<>< Lance.
#------START OF SCRIPT-----------
#!/bin/bash
count=0
icount=0
while [ 1 ]; do
cp /proc/mdstat /dev/null
let count=count+1
let icount=icount+1
if [ $icount = 100 ]; then
cat /proc/mdstat
sleep 1
echo $count
icount=0
fi
done
#------END OF SCRIPT-----------