Codebase list mdadm / d02c620
Add support for 'repair' action to checkarray. (Closes: #772465) Enables the use of the repair action in the cron checkarray script. The 'repair' mode must be enabled manually in order to take effect, so deployed systems continue to operate under the lower risk of the 'check' mode. Authorship of this commit was acknowledged in Git. Thank you to Henrique de Moraes Holschuh! Henrique de Moraes Holschuh authored 2 years ago Felix Lechner committed 2 years ago
1 changed file(s) with 8 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2626 -a|--all check all assembled arrays (ignores arrays in command line).
2727 -s|--status print redundancy check status of devices.
2828 -x|--cancel queue a request to cancel a running redundancy check.
29 -r|--repair repair instead of check
2930 -i|--idle perform check in a lowest scheduling class (idle)
3031 -l|--slow perform check in a lower-than-standard scheduling class
3132 -f|--fast perform check in higher-than-standard scheduling class
4546 Devices can be specified in almost any format. The following are equivalent:
4647 /dev/md0, md0, /dev/md/0, /sys/block/md0
4748
48 You can also control the status of a check with /proc/mdstat file."
49 You can also control the status of a check/repair with /proc/mdstat file."
4950 }
5051
51 SHORTOPTS=achVqQsxilf
52 LONGOPTS=all,cron,help,version,quiet,real-quiet,status,cancel,idle,slow,fast,realtime
52 SHORTOPTS=achVqQsxrilf
53 LONGOPTS=all,cron,help,version,quiet,real-quiet,status,cancel,repair,idle,slow,fast,realtime
5354
5455 eval set -- $(getopt -o $SHORTOPTS -l $LONGOPTS -n $PROGNAME -- "$@")
5556
6667 -a|--all) all=1;;
6768 -s|--status) action=status;;
6869 -x|--cancel) action=idle;;
70 -r|--repair) action=repair;;
6971 -i|--idle) ionice=idle;;
7072 -l|--slow) ionice=low;;
7173 -f|--fast) ionice=high;;
164166 [ $quiet -lt 1 ] && echo "$PROGNAME: I: cancel request queued for array $array." >&2
165167 ;;
166168
167 check)
169 check|repair)
168170 if [ "$cur_status" != idle ]; then
169171 [ $quiet -lt 2 ] && echo "$PROGNAME: W: array $array not idle, skipping..." >&2
170172 continue
186188 fi
187189
188190 # queue request for the array. The kernel will make sure that these requests
189 # are properly queued so as to not kill one of the array.
191 # are properly queued so as to not kill one of the arrays.
190192 echo $action > $MDBASE/sync_action
191 [ $quiet -lt 1 ] && echo "$PROGNAME: I: check queued for array $array." >&2
193 [ $quiet -lt 1 ] && echo "$PROGNAME: I: $action queued for array $array." >&2
192194
193195 case "$ionice" in
194196 idle) ioarg='-c3'; renice=15;;