summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2015-07-06 13:58:19 +1000
committerNeilBrown <neilb@suse.de>2015-07-06 13:58:19 +1000
commita76b3a345b23193007b0e5ffd9881281d041d094 (patch)
treefcf50f907ba5515263906c46ba623d5fe72dd312
parent602b9169510a9731ef4dc9b116b764bc57d5b44c (diff)
downloadmdadm-a76b3a345b23193007b0e5ffd9881281d041d094.tar.gz
test: check sync_action as well when checking for an action.
Some actions only appear in /proc/mdstat after a little delay, so check in sync_action as well. This applies when checking for recovery etc, and when waiting for idle. Signed-off-by: NeilBrown <neilb@suse.de>
-rwxr-xr-xtest19
1 files changed, 14 insertions, 5 deletions
diff --git a/test b/test
index 0e168ff..6f79c3a 100755
--- a/test
+++ b/test
@@ -188,10 +188,18 @@ check() {
echo >&2 "ERROR algorithm $2 not found"; cat /proc/mdstat; exit 1;}
;;
resync | recovery | reshape)
- sleep 0.5
- grep -s $1 /proc/mdstat > /dev/null || {
- echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
- ;;
+ cnt=5
+ while ! grep -s $1 /proc/mdstat > /dev/null
+ do
+ if [ $cnt -gt 0 ] && grep -v idle /sys/block/md*/md/sync_action > /dev/null
+ then # Something isn't idle - wait a bit
+ sleep 0.5
+ cnt=$[cnt-1]
+ else
+ echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1
+ fi
+ done
+ ;;
nosync )
sleep 0.5
@@ -204,7 +212,8 @@ check() {
p=`cat /proc/sys/dev/raid/speed_limit_max`
echo 2000000 > /proc/sys/dev/raid/speed_limit_max
sleep 0.1
- while grep -E '(resync|recovery|reshape|check|repair) *=' > /dev/null /proc/mdstat /sys/block/md*/md/sync_action
+ while grep -E '(resync|recovery|reshape|check|repair) *=' > /dev/null /proc/mdstat ||
+ grep -v idle > /dev/null /sys/block/md*/md/sync_action
do sleep 0.5;
done
echo $p > /proc/sys/dev/raid/speed_limit_max