Bug#510641: Patch against checkarray to skip auto-read-only arrays
Andreas Schamanek
as2007+dbts at fam.tuwien.ac.at
Sun Apr 5 22:12:34 UTC 2009
The following diff might not be an ideal solution. Anyway, I had a
system with a non-swap array in auto-read-only state (array_state =
read-auto), indeed an array which currently is simply not used. Thus,
I changed _checkarray_ to skip it with a warning (change "$quiet -lt
2" to "$quiet -lt 1" if you want the cronjob to be silent about it).
--- checkarray.o 2009-02-05 20:49:08.000000000 +0100
+++ /usr/share/mdadm/checkarray 2009-04-05 23:55:59.000000000 +0200
@@ -27,7 +27,7 @@
cat <<-_eof | column -s\& -t
-a|--all & check all assembled arrays (check /proc/mdstat).
-c|--cron & honour AUTOCHECK setting in /etc/default/mdadm.
- -s|--status & print redundancy check status of devices.
+ -s|--status & print redundancy check and array status of devices.
-x|--cancel & queue a request to cancel a running redundancy check.
-q|--quiet & suppress informational messages.
-Q|--real-quiet & suppress all output messages, including warnings and errors.
@@ -132,6 +132,7 @@
for array in $arrays; do
SYNC_ACTION_CTL=/sys/block/$array/md/sync_action
+ ARRAY_STATE=/sys/block/$array/md/array_state
if [ ! -e $SYNC_ACTION_CTL ]; then
[ $quiet -lt 1 ] && echo "$PROGNAME: I: skipping non-redundant array $array." >&2
@@ -139,9 +140,10 @@
fi
cur_status="$(cat $SYNC_ACTION_CTL)"
+ array_state="$(cat $ARRAY_STATE)"
if [ $action = status ]; then
- echo "$array: $cur_status"
+ echo "$array: $cur_status ($array_state)"
continue
fi
@@ -161,6 +163,10 @@
[ $quiet -lt 2 ] && echo "$PROGNAME: W: array $array not idle, skipping..." >&2
continue
fi
+ if [ "$array_state" = read-auto ]; then
+ [ $quiet -lt 2 ] && echo "$PROGNAME: W: array $array is in auto-read-only state, skipping..." >&2
+ continue
+ fi
# queue request for the array. The kernel will make sure that these requests
# are properly queued so as to not kill one of the array.
HTH,
--
-- Andreas
More information about the pkg-mdadm-devel
mailing list