From: Harald Hoyer Date: Wed, 4 Nov 2009 10:48:12 +0000 (+0100) Subject: 95dasd: fixed rd_DASD argument handling X-Git-Tag: 003~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8686bd554ba66d861e7b1198f98215e8543eecbc;p=thirdparty%2Fdracut.git 95dasd: fixed rd_DASD argument handling --- diff --git a/dracut.8 b/dracut.8 index ca7a7cad9..92598e61f 100644 --- 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=[,readonly=X][,use_diag=X][,erplog=X][,failfast=X] -activate DASD device at given CCW address and setting the sysfs attributes +.B rd_DASD=[,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 diff --git a/dracut.spec b/dracut.spec index 40a1dd7c5..4f068b5ae 100644 --- a/dracut.spec +++ b/dracut.spec @@ -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 002-20 +- fix rd_DASD argument handling (bug #531720) +- Resolves: rhbz#531720 + * Tue Nov 03 2009 Harald Hoyer 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 index 000000000..5364935a4 --- /dev/null +++ b/modules.d/95dasd/56-dasd.rules @@ -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" diff --git a/modules.d/95dasd/dasdconf.sh b/modules.d/95dasd/dasdconf.sh index 40a8ff9bc..fb3ac90eb 100755 --- a/modules.d/95dasd/dasdconf.sh +++ b/modules.d/95dasd/dasdconf.sh @@ -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 diff --git a/modules.d/95dasd/install b/modules.d/95dasd/install index d918dae6c..9d0b98c91 100755 --- a/modules.d/95dasd/install +++ b/modules.d/95dasd/install @@ -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 diff --git a/modules.d/95dasd_mod/install b/modules.d/95dasd_mod/install index 8545a2534..0704c5cbb 100755 --- a/modules.d/95dasd_mod/install +++ b/modules.d/95dasd_mod/install @@ -1,3 +1,3 @@ #!/bin/bash -inst_hook cmdline 30 "$moddir/parse-dasd.sh" +inst_hook cmdline 30 "$moddir/parse-dasd-mod.sh" diff --git a/modules.d/95dasd_mod/parse-dasd.sh b/modules.d/95dasd_mod/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 6902eebca..023c9ad7c 100755 --- a/modules.d/95dasd_mod/parse-dasd.sh +++ b/modules.d/95dasd_mod/parse-dasd-mod.sh @@ -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