]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
95dasd: fixed rd_DASD argument handling
authorHarald Hoyer <harald@redhat.com>
Wed, 4 Nov 2009 10:48:12 +0000 (11:48 +0100)
committerHarald Hoyer <harald@redhat.com>
Fri, 6 Nov 2009 07:44:01 +0000 (08:44 +0100)
dracut.8
dracut.spec
modules.d/95dasd/56-dasd.rules [new file with mode: 0644]
modules.d/95dasd/dasdconf.sh
modules.d/95dasd/install
modules.d/95dasd_mod/install
modules.d/95dasd_mod/parse-dasd-mod.sh [moved from modules.d/95dasd_mod/parse-dasd.sh with 63% similarity]

index ca7a7cad91afd29b479ffd8f8d5ad3355a55fdfe..92598e61fb551d846ea8abbec7b4e78e757915d6 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -180,8 +180,8 @@ only activate the raid sets with the given UUID
 same syntax as the kernel module parameter (s390 only)
 
 .TP
-.B rd_DASD=<CCW address>[,readonly=X][,use_diag=X][,erplog=X][,failfast=X]
-activate DASD device at given CCW address and setting the sysfs attributes
+.B rd_DASD=<dasd adaptor device bus ID>[,readonly=X][,use_diag=X][,erplog=X][,failfast=X]
+activate DASD device with the given adaptor device bus ID and setting the sysfs attributes
 to the specified values
 
 .SH ZFCP
index 40a1dd7c5cb27cf1e60211a7d03e3dfae57c4178..4f068b5ae5677faf662ecf41b083c6f1983f40f2 100644 (file)
@@ -1,4 +1,3 @@
-%define gittag 78b52181
 %define with_switch_root 1
 
 %if 0%{?fedora} > 11
@@ -18,7 +17,7 @@
 
 Name: dracut
 Version: 002
-Release: 19%{?rdist}
+Release: 20%{?rdist}
 Summary: Initramfs generator using udev
 Group: System Environment/Base         
 License: GPLv2+        
@@ -195,6 +194,10 @@ rm -rf $RPM_BUILD_ROOT
 %dir /var/lib/dracut/overlay
 
 %changelog
+* Wed Nov 04 2009 Harald Hoyer <harald@redhat.com> 002-20
+- fix rd_DASD argument handling (bug #531720)
+- Resolves: rhbz#531720
+
 * Tue Nov 03 2009 Harald Hoyer <harald@redhat.com> 002-19
 - changed rd_DASD to rd_DASD_MOD (bug #531720)
 - Resolves: rhbz#531720
diff --git a/modules.d/95dasd/56-dasd.rules b/modules.d/95dasd/56-dasd.rules
new file mode 100644 (file)
index 0000000..5364935
--- /dev/null
@@ -0,0 +1,16 @@
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="dasd-eckd", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="dasd-fba", RUN+="/sbin/dasdconf.sh"
+
+# This list should be autogenerated with "modinfo dasd_{eckd,fba}_mod"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t1750m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t1750m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2107m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2107m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t9343m*dt9345dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2105m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3990m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3880m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2105m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3990m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3880m*dt3370dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t6310m*dt9336dm*", RUN+="/sbin/dasdconf.sh"
index 40a8ff9bc2decff2e9746c36100f06053e010d8d..fb3ac90eb36fbb9bcd69fa4981443ea4f6b3a787 100755 (executable)
@@ -8,12 +8,24 @@
 # 0.0.0204
 # 0.0.0205 erplog=1
 
+[ -z "$DEVPATH" ] && exit 0
+[ "$ACTION" != "add" ] && exit 0
+
+CHANNEL=${DEVPATH##*/}
+
 CONFIG=/etc/dasd.conf
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+export PATH
+
+warn() {
+    [ -e /dev/kmsg ] && echo "<4>dasdconf.sh Warning: $@" > /dev/kmsg
+    echo "dasdconf.sh Warning: $@" >&2
+}
 
 if [ -f "$CONFIG" ]; then
     if [ ! -d /sys/bus/ccw/drivers/dasd-eckd ] && [ ! -d /sys/bus/ccw/drivers/dasd-fba ]; then
-        return
+       #warn "No dasd-eckd or dasd-eckd loaded"
+        exit 0
     fi
     tr "A-Z" "a-z" < $CONFIG | while read line; do
         case $line in
@@ -21,34 +33,62 @@ if [ -f "$CONFIG" ]; then
             *)
                 [ -z "$line" ] && continue
                 set $line
+
+               # if we are in single add mode, only add the new CHANNEL
+               [ "$SUBSYSTEM" = "ccw" ] && [ "$1" != "$CHANNEL" ] && continue
+
                 DEVICE=$1
                 SYSFSPATH=
+
                 if [ -r "/sys/bus/ccw/drivers/dasd-eckd/$DEVICE" ]; then
                     SYSFSPATH="/sys/bus/ccw/drivers/dasd-eckd/$DEVICE"
                 elif [ -r "/sys/bus/ccw/drivers/dasd-fba/$DEVICE" ]; then
                     SYSFSPATH="/sys/bus/ccw/drivers/dasd-fba/$DEVICE"
                 else
+                   # if we are in single add mode, this is a failure!
+                   [ "$SUBSYSTEM" = "ccw" ] && warn "Could not find $DEVICE in sysfs"
                     continue
                 fi
-                echo 1 > $SYSFSPATH/online
+
+               # skip already onlined devices
+               if [ "$(cat $SYSFSPATH/online)" = "1" ]; then
+                   if [ "$SUBSYSTEM" = "ccw" ]; then
+                       # if we are in single add mode, we should not touch the device
+                       warn "$DEVICE is already online, not configuring"
+                       exit 0
+                   fi
+                   continue
+               fi
+
                 shift
-                while [ ! -z "$1" ]; do
+                while [ -n "$1" ]; do
                     (
                         attribute="$1"
                         IFS="="
                         set $attribute
-                        case "$1" in
-                            readonly|use_diag|erplog|failfast)
-                                if [ -r "$SYSFSPATH/$1" ]; then
-                                    echo $2 > $SYSFSPATH/$1
-                                fi
-                                ;;
-                        esac
+
+                        if [ "$1" = "use_diag" ]; then
+                           # this module better only returns after
+                           # all sysfs entries have the "use_diag" file
+                            modprobe dasd_diag_mod
+                        fi
+
+                        if [ -r "$SYSFSPATH/$1" ]; then
+                            echo $2 > $SYSFSPATH/$1 || warn "Could not set $1=$2 for $DEVICE"
+                        else
+                           warn "$1 does not exist for $DEVICE"
+                        fi
                     )
                     shift
                 done
-                echo
+               
+               # Now, put the device online
+                echo 1 > $SYSFSPATH/online || echo "Could not activate $DEVICE"
+
+               # if we are in single add mode, we are done
+               [ "$SUBSYSTEM" = "ccw" ] && exit 0
                 ;;
         esac
     done
 fi
+exit 0
index d918dae6c92d57cf915f5f3d7577d32e3604c754..9d0b98c916e013bd02f019ace2e65fbc944d50ca 100755 (executable)
@@ -2,4 +2,5 @@
 inst_hook cmdline 30 "$moddir/parse-dasd.sh"
 dracut_install tr
 inst "$moddir/dasdconf.sh" /sbin/dasdconf.sh
+inst_rules "$moddir/56-dasd.rules"
 inst /etc/dasd.conf
index 8545a25346c47dae8dcda78fa757b31cef59942b..0704c5cbb0dbf4b5be3cc089697890831c4badcc 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/bash
-inst_hook cmdline 30 "$moddir/parse-dasd.sh"
+inst_hook cmdline 30 "$moddir/parse-dasd-mod.sh"
 
similarity index 63%
rename from modules.d/95dasd_mod/parse-dasd.sh
rename to modules.d/95dasd_mod/parse-dasd-mod.sh
index 6902eebca222c0c1f3c786d319f3ca896ea6ea5f..023c9ad7c9259a392f6e9a9d3d4c30eab632f60a 100755 (executable)
@@ -2,6 +2,6 @@
 
 dasd_arg=$(getarg rd_DASD_MOD=)
 if [ -n "$dasd_arg" ]; then
-       echo "options dasd_mod dasd=$dasd_arg" >> /etc/modprobe.d/dasd.conf
+       echo "options dasd_mod dasd=$dasd_arg" >> /etc/modprobe.d/dasd_mod.conf
 fi
 unset dasd_arg