Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tests/07reshape5intr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,21 @@ do
echo 1000 > /proc/sys/dev/raid/speed_limit_min
echo 2000 > /proc/sys/dev/raid/speed_limit_max
check wait
while ! echo check > /sys/block/md0/md/sync_action; do sleep 0.1; done

max=5

for ((i = 0 ; i < max ; i++ )); do
if [[ $(echo check > /sys/block/md0/md/sync_action) != 0 ]]; then
break;
fi
sleep 1
done

if [[ i == max ]]; then
echo >&2 "Timeout waiting for check to succeed"
exit 1
fi

check wait
mm=`cat /sys/block/md0/md/mismatch_cnt`
if [ $mm -gt 0 ]
Expand Down
45 changes: 38 additions & 7 deletions tests/func.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,24 @@ restore_selinux() {
setenforce $sys_selinux
}

wait_for_reshape_end() {
# wait for grow-continue to finish but break if sync_action does not
# contain any reshape value
while true
do
sync_action=$(grep -Ec '(resync|recovery|reshape|check|repair) *=' /proc/mdstat)
if (( "$sync_action" != 0 )); then
sleep 1
continue
elif [[ $(pgrep -f "mdadm --grow --continue" > /dev/null) != "" ]]; then
echo "Grow continue did not finish but reshape is done" >&2
exit 1
else
break
fi
done
}

setup_systemd_env() {
warn "Warning! Test suite will set up systemd environment!\n"
echo "Use \"systemctl show-environment\" to show systemd environment variables"
Expand Down Expand Up @@ -357,15 +375,28 @@ check() {
max=`cat /proc/sys/dev/raid/speed_limit_max`
echo 200000 > /proc/sys/dev/raid/speed_limit_max
sleep 0.1
while grep -Eq '(resync|recovery|reshape|check|repair) *=' /proc/mdstat ||
grep -v idle > /dev/null /sys/block/md*/md/sync_action
iterations=0
# Wait 10 seconds for one of the actions appears in sync_action.
while [ $iterations -le 10 ]
do
sleep 0.5
done
while ps auxf | grep "mdadm --grow --continue" | grep -v grep
do
sleep 1
sync_action=$(grep -Ec '(resync|recovery|reshape|check|repair) *=' /proc/mdstat)
if (( "$sync_action" == 0 )); then
sleep 1
iterations=$(( $iterations + 1 ))
continue
else
break
fi
done
echo "Reshape has not started after 10 seconds"

# Now let's wait for reshape to finish.
echo "Waiting for grow-continue to finish"
wait_for_reshape_end
# If we have matrix-raid there's a second process ongoing
sleep 5
wait_for_reshape_end

echo $min > /proc/sys/dev/raid/speed_limit_min
echo $max > /proc/sys/dev/raid/speed_limit_max
;;
Expand Down
2 changes: 0 additions & 2 deletions tests/imsm-grow-template
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ else
exit 1
fi
else
sleep 5
check wait
sleep 5
check wait
imsm_check member $member0 $num_disks $vol0_level $vol0_comp_size $((vol0_comp_size * vol0_new_num_comps)) $vol0_offset $vol0_chunk
testdev $member0 $vol0_new_num_comps $vol0_comp_size $vol0_chunk
Expand Down