summaryrefslogtreecommitdiffstats
path: root/tests/07reshape5intr
blob: 2af29101c4c73f76b81015a4ab1ec5d208a973aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# test interrupting and restarting raid5 reshape.
set -x
devs="$dev1"
st=UU
for disks in 2 3 4 5
do
  eval devs=\"$devs \$dev$disks\"
  st=U$st
  for d in $devs
  do dd if=/dev/urandom of=$d bs=1024 || true
  done

  case $disks in
   2 | 3) chunk=1024;;
   4 ) chunk=512;;
   5 ) chunk=256;;
  esac

  mdadm -CR $md0 -amd -l5 -c $chunk -n$disks --assume-clean $devs
  mdadm $md0 --add $dev6
  echo 20 > /proc/sys/dev/raid/speed_limit_min
  echo 20 > /proc/sys/dev/raid/speed_limit_max
  mdadm --grow $md0 -n $[disks+1]
  check reshape
  check state $st
  mdadm --stop $md0
  mdadm --assemble $md0 $devs $dev6
  check reshape
  echo 1000 > /proc/sys/dev/raid/speed_limit_min
  echo 2000 > /proc/sys/dev/raid/speed_limit_max
  check wait

  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 ]
  then echo >&2 "ERROR mismatch_cnt non-zero : $mm" ; exit 1
  fi
  mdadm -S $md0
done