95dasd: fixed rd_DASD argument handling

master
Harald Hoyer 2009-11-04 11:48:12 +01:00
parent 62cfb5c161
commit 8686bd554b
7 changed files with 78 additions and 18 deletions

View File

@ -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

View 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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,3 @@
#!/bin/bash
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
inst_hook cmdline 30 "$moddir/parse-dasd-mod.sh"


View File

@ -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