From 6fd1cc12f95eaba13896a37eb48279a21b4e41cd Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Jan 13 2010 19:33:07 +0000 Subject: Poll DASD status for 'online' or 'unformatted' (#536803) Give DASD devices some time to enter the online or unformatted state before calling udevadm settle. Max duration of loop is suggestion from IBM. --- diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index a3ee665..7fd3f4f 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -129,6 +129,25 @@ function sysecho () { [ -f "$file" ] && echo $* > $file } +function dasd_settle() { + local dasd=/sys/bus/ccw/devices/$1 + if [ ! -d "$dasd" ]; then + return 1 + fi + local i=1 + while [ $i -le 30 ] ; do + status="$(< /sys/bus/ccw/devices/$dasd/status 2>/dev/null)" + case $status in + online|unformatted) + return 0 ;; + *) + sleep 0.1 + i=$((i+1)) ;; + esac + done + return 1 +} + function startinetd() { echo @@ -190,6 +209,11 @@ function readcmsfile() # $1=dasdport $2=filename return 1 fi udevadm settle + if ! dasd_settle $dev ; then + echo $"Could not access DASD $dev in time" + return 1 + fi + udevadm settle if ! cmsfscat -d /dev/dasda -a $2 > /tmp/$2; then echo $"Could not read conf file $2 on CMS DASD $1." fi