test: assume recovery has completed if sync_completed says so.

The final completion of a recovery can be delayed, so use
sync_completed to check if it is finished, just not been reaped.

Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
NeilBrown 2015-07-23 11:17:10 +10:00
parent 4108d695e3
commit 6fba5a339c
1 changed files with 8 additions and 0 deletions

8
test
View File

@ -205,8 +205,16 @@ check() {
nosync )
sleep 0.5
# Since 4.2 we delay the close of recovery until there has been a chance for
# spares to be activated. That means that a recovery that finds nothing
# to do can still take a little longer than expected.
# add an extra check: is sync_completed shows the end is reached, assume
# there is no recovery.
if grep -s -E '(resync|recovery|reshape) *=' > /dev/null /proc/mdstat ; then
incomplete=`grep / /sys/block/md*/md/sync_completed 2> /dev/null | sed '/^ *\([0-9]*\) \/ \1/d'`
if [ -n "$incomplete" ]; then
echo >&2 "ERROR resync or recovery is happening!"; cat /proc/mdstat ; exit 1;
fi
fi
;;