|
 |
218d2d |
From 71876ea8c73090741bdf26abb89c28fb260ed575 Mon Sep 17 00:00:00 2001
|
|
 |
218d2d |
From: Steffen Maier <maier@linux.ibm.com>
|
|
 |
218d2d |
Date: Fri, 20 Jan 2023 18:22:19 +0100
|
|
 |
218d2d |
Subject: [PATCH 08/23] feat(zfcp_rules): remove zfcp handling consolidated in
|
|
 |
218d2d |
s390-tools
|
|
 |
218d2d |
|
|
 |
218d2d |
These are handled by s390-tools zdev dracut module 95zdev as of
|
|
 |
218d2d |
https://github.com/ibm-s390-linux/s390-tools/commit/06a30ae529a5d6ad2369ed81da056bf3a6147bb6
|
|
 |
218d2d |
("zdev/dracut: add rd.zfcp cmdline option handling").
|
|
 |
218d2d |
|
|
 |
218d2d |
Even though this removes one implementation of parsing rd.zfcp in dracut,
|
|
 |
218d2d |
above s390-tools change introduces another implementation of parsing the
|
|
 |
218d2d |
exact same rd.zfcp syntax. Therefore, it would be good to keep the
|
|
 |
218d2d |
documentation in man/dracut.cmdline.7 of dracut as one central place
|
|
 |
218d2d |
describing all s390 device types that dracut handles.
|
|
 |
218d2d |
|
|
 |
218d2d |
This also fixes problems such as RHBZ 1552619/1745470. It was due to a
|
|
 |
218d2d |
duplicate configuration because the SUSE-specific module 95zfcp_rules does
|
|
 |
218d2d |
not have any distro-specific dependency and thus also ran in Red Hat
|
|
 |
218d2d |
distros.
|
|
 |
218d2d |
|
|
 |
218d2d |
That also caused a kind of competition with 95zfcp regarding the same hook
|
|
 |
218d2d |
registration:
|
|
 |
218d2d |
inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
|
|
 |
218d2d |
"luckily" 95zfcp wins since it runs lexicographically first
|
|
 |
218d2d |
and the first one registering the hook via inst_simple wins.
|
|
 |
218d2d |
|
|
 |
218d2d |
Because commit c8aa1d949aec ("95zfcp_rules: simplified rd.zfcp commandline
|
|
 |
218d2d |
for NPIV") extended the emitted rd.zfcp syntax for hostonly-cmdline in
|
|
 |
218d2d |
95zfcp_rules, kdump initrds built with hostonly-cmdline parsed such rd.zfcp
|
|
 |
218d2d |
with 95zfcp, which did not understand the extended syntax yet and aborted
|
|
 |
218d2d |
early boot with a syntax error.
|
|
 |
218d2d |
|
|
 |
218d2d |
It also seems that parse-zfcp.sh on its own is without effect because
|
|
 |
218d2d |
create_udev_rule() [similar to what zfcp_disk_configure had generated] does
|
|
 |
218d2d |
not handle the pre-requisite of setting an FCP device (vHBA) online first.
|
|
 |
218d2d |
So the rport match does not trigger unless something else happens to set an
|
|
 |
218d2d |
FCP device online [such as rules generated by zfcp_host_configure]. Related
|
|
 |
218d2d |
to commit d40c49a8dfe2 ("fix(zfcp_rules): remove collect based udev rule
|
|
 |
218d2d |
creators").
|
|
 |
218d2d |
|
|
 |
218d2d |
module-setup.sh having copied all udev rules from the root-fs into the
|
|
 |
218d2d |
initrd conflicted with s390-tools dracut module zdev-kdump, which
|
|
 |
218d2d |
intentionally only activates the dependencies of the kdump target.
|
|
 |
218d2d |
|
|
 |
218d2d |
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
|
|
 |
218d2d |
---
|
|
 |
218d2d |
modules.d/95zfcp_rules/module-setup.sh | 80 --------------------------
|
|
 |
218d2d |
modules.d/95zfcp_rules/parse-zfcp.sh | 74 ------------------------
|
|
 |
218d2d |
2 files changed, 154 deletions(-)
|
|
 |
218d2d |
delete mode 100755 modules.d/95zfcp_rules/module-setup.sh
|
|
 |
218d2d |
delete mode 100755 modules.d/95zfcp_rules/parse-zfcp.sh
|
|
 |
218d2d |
|
|
 |
218d2d |
diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh
|
|
 |
218d2d |
deleted file mode 100755
|
|
 |
218d2d |
index dfa79514..00000000
|
|
 |
218d2d |
--- a/modules.d/95zfcp_rules/module-setup.sh
|
|
 |
218d2d |
+++ /dev/null
|
|
 |
218d2d |
@@ -1,80 +0,0 @@
|
|
 |
218d2d |
-#!/bin/bash
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-# called by dracut
|
|
 |
218d2d |
-cmdline() {
|
|
 |
218d2d |
- is_zfcp() {
|
|
 |
218d2d |
- local _dev=$1
|
|
 |
218d2d |
- local _devpath
|
|
 |
218d2d |
- _devpath=$(
|
|
 |
218d2d |
- cd -P /sys/dev/block/"$_dev" || exit
|
|
 |
218d2d |
- echo "$PWD"
|
|
 |
218d2d |
- )
|
|
 |
218d2d |
- local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type
|
|
 |
218d2d |
- local _allow_lun_scan _is_npiv
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- read -r _allow_lun_scan < /sys/module/zfcp/parameters/allow_lun_scan
|
|
 |
218d2d |
- [ "${_devpath#*/sd}" == "$_devpath" ] && return 1
|
|
 |
218d2d |
- _sdev="${_devpath%%/block/*}"
|
|
 |
218d2d |
- [ -e "${_sdev}"/fcp_lun ] || return 1
|
|
 |
218d2d |
- _scsiid="${_sdev##*/}"
|
|
 |
218d2d |
- _hostno="${_scsiid%%:*}"
|
|
 |
218d2d |
- [ -d /sys/class/fc_host/host"${_hostno}" ] || return 1
|
|
 |
218d2d |
- read -r _port_type < /sys/class/fc_host/host"${_hostno}"/port_type
|
|
 |
218d2d |
- case "$_port_type" in
|
|
 |
218d2d |
- NPIV*)
|
|
 |
218d2d |
- _is_npiv=1
|
|
 |
218d2d |
- ;;
|
|
 |
218d2d |
- esac
|
|
 |
218d2d |
- read -r _ccw < "${_sdev}"/hba_id
|
|
 |
218d2d |
- if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ]; then
|
|
 |
218d2d |
- echo "rd.zfcp=${_ccw}"
|
|
 |
218d2d |
- else
|
|
 |
218d2d |
- read -r _lun < "${_sdev}"/fcp_lun
|
|
 |
218d2d |
- read -r _wwpn < "${_sdev}"/wwpn
|
|
 |
218d2d |
- echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
- return 0
|
|
 |
218d2d |
- }
|
|
 |
218d2d |
- [[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
 |
218d2d |
- for_each_host_dev_and_slaves_all is_zfcp
|
|
 |
218d2d |
- } | sort | uniq
|
|
 |
218d2d |
-}
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-# called by dracut
|
|
 |
218d2d |
-check() {
|
|
 |
218d2d |
- local _arch=${DRACUT_ARCH:-$(uname -m)}
|
|
 |
218d2d |
- local _ccw
|
|
 |
218d2d |
- [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- [[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
 |
218d2d |
- found=0
|
|
 |
218d2d |
- for _ccw in /sys/bus/ccw/devices/*/host*; do
|
|
 |
218d2d |
- [ -d "$_ccw" ] || continue
|
|
 |
218d2d |
- found=$((found + 1))
|
|
 |
218d2d |
- done
|
|
 |
218d2d |
- [ $found -eq 0 ] && return 255
|
|
 |
218d2d |
- }
|
|
 |
218d2d |
- return 0
|
|
 |
218d2d |
-}
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-# called by dracut
|
|
 |
218d2d |
-depends() {
|
|
 |
218d2d |
- echo bash
|
|
 |
218d2d |
- return 0
|
|
 |
218d2d |
-}
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-# called by dracut
|
|
 |
218d2d |
-install() {
|
|
 |
218d2d |
- inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
|
|
 |
218d2d |
- if [[ $hostonly_cmdline == "yes" ]]; then
|
|
 |
218d2d |
- local _zfcp
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- for _zfcp in $(cmdline); do
|
|
 |
218d2d |
- printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf"
|
|
 |
218d2d |
- done
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
- if [[ $hostonly ]]; then
|
|
 |
218d2d |
- inst_rules_wildcard "51-zfcp-*.rules"
|
|
 |
218d2d |
- inst_rules_wildcard "41-zfcp-*.rules"
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
-}
|
|
 |
218d2d |
diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh
|
|
 |
218d2d |
deleted file mode 100755
|
|
 |
218d2d |
index a474b81b..00000000
|
|
 |
218d2d |
--- a/modules.d/95zfcp_rules/parse-zfcp.sh
|
|
 |
218d2d |
+++ /dev/null
|
|
 |
218d2d |
@@ -1,74 +0,0 @@
|
|
 |
218d2d |
-#!/bin/bash
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-create_udev_rule() {
|
|
 |
218d2d |
- local ccw=$1
|
|
 |
218d2d |
- local wwpn=$2
|
|
 |
218d2d |
- local lun=$3
|
|
 |
218d2d |
- local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
|
|
 |
218d2d |
- local _cu_type _dev_type
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then
|
|
 |
218d2d |
- cio_ignore -r "$ccw"
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- if [ -e /sys/bus/ccw/devices/"${ccw}" ]; then
|
|
 |
218d2d |
- read -r _cu_type < /sys/bus/ccw/devices/"${ccw}"/cutype
|
|
 |
218d2d |
- read -r _dev_type < /sys/bus/ccw/devices/"${ccw}"/devtype
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
- if [ "$_cu_type" != "1731/03" ]; then
|
|
 |
218d2d |
- return 0
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
- if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ]; then
|
|
 |
218d2d |
- return 0
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- [ -z "$wwpn" ] || [ -z "$lun" ] && return
|
|
 |
218d2d |
- m=$(sed -n "/.*${wwpn}.*${lun}.*/p" "$_rule")
|
|
 |
218d2d |
- if [ -z "$m" ]; then
|
|
 |
218d2d |
- cat >> "$_rule" << EOF
|
|
 |
218d2d |
-ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
|
|
 |
218d2d |
-EOF
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
-}
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-if [[ -f /sys/firmware/ipl/ipl_type ]] \
|
|
 |
218d2d |
- && [[ $(< /sys/firmware/ipl/ipl_type) == "fcp" ]]; then
|
|
 |
218d2d |
- (
|
|
 |
218d2d |
- read -r _wwpn < /sys/firmware/ipl/wwpn
|
|
 |
218d2d |
- read -r _lun < /sys/firmware/ipl/lun
|
|
 |
218d2d |
- read -r _ccw < /sys/firmware/ipl/device
|
|
 |
218d2d |
-
|
|
 |
218d2d |
- create_udev_rule "$_ccw" "$_wwpn" "$_lun"
|
|
 |
218d2d |
- )
|
|
 |
218d2d |
-fi
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-for zfcp_arg in $(getargs rd.zfcp); do
|
|
 |
218d2d |
- (
|
|
 |
218d2d |
- OLDIFS="$IFS"
|
|
 |
218d2d |
- IFS=","
|
|
 |
218d2d |
- # shellcheck disable=SC2086
|
|
 |
218d2d |
- set $zfcp_arg
|
|
 |
218d2d |
- IFS="$OLDIFS"
|
|
 |
218d2d |
- create_udev_rule "$1" "$2" "$3"
|
|
 |
218d2d |
- )
|
|
 |
218d2d |
-done
|
|
 |
218d2d |
-
|
|
 |
218d2d |
-for zfcp_arg in $(getargs root=) $(getargs resume=); do
|
|
 |
218d2d |
- (
|
|
 |
218d2d |
- case $zfcp_arg in
|
|
 |
218d2d |
- /dev/disk/by-path/ccw-*)
|
|
 |
218d2d |
- ccw_arg=${zfcp_arg##*/}
|
|
 |
218d2d |
- ;;
|
|
 |
218d2d |
- esac
|
|
 |
218d2d |
- if [ -n "$ccw_arg" ]; then
|
|
 |
218d2d |
- OLDIFS="$IFS"
|
|
 |
218d2d |
- IFS="-"
|
|
 |
218d2d |
- # shellcheck disable=SC2086
|
|
 |
218d2d |
- set -- $ccw_arg
|
|
 |
218d2d |
- IFS="$OLDIFS"
|
|
 |
218d2d |
- _wwpn=${4%:*}
|
|
 |
218d2d |
- _lun=${4#*:}
|
|
 |
218d2d |
- create_udev_rule "$2" "$wwpn" "$lun"
|
|
 |
218d2d |
- fi
|
|
 |
218d2d |
- )
|
|
 |
218d2d |
-done
|
|
 |
218d2d |
--
|
|
 |
218d2d |
2.42.0
|
|
 |
218d2d |
|