[PATCH 2/3] Poll DASD status for 'online' or 'unformatted' (#536803)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Give DASD devices some time to enter the online or unformatted state
before calling udevadm settle.  Max duration of loop is suggestion from
IBM.
---
 loader/linuxrc.s390 |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index a3ee665..7b09ea4 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -129,6 +129,25 @@ function sysecho () {
     [ -f "$file" ] && echo $* > $file
 }
 
+function dasd_settle() {
+    dasd=/sys/bus/ccw/devices/$1
+    if [ ! -d "$dasd" ]; then
+        return 0
+    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 1 ;;
+            *)
+                sleep 0.1
+                i=$((i+1)) ;;
+        esac
+    done
+    return 0
+}
+
 function startinetd()
 {
     echo
@@ -189,6 +208,10 @@ function readcmsfile() # $1=dasdport $2=filename
         echo $"DASD $dev could not be set online"
         return 1
     fi
+    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."
@@ -197,6 +220,10 @@ function readcmsfile() # $1=dasdport $2=filename
         echo $"DASD $dev could not be set offline again"
         return 1
     fi
+    if ! dasd_settle $dev ; then
+        echo $"Could not access DASD $dev in time"
+        return 1
+    fi
     udevadm settle
     # consequences of no more module unload: loader can no longer
     # use DASD module option to online DASDs and set other DASD parameters!
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux