From 7b8c78ff43a1f8e3690969e980d3d9d1dcb00c87 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 31 Mar 2021 10:18:27 +0200 Subject: [PATCH] fix(multipath): revise multipathd-stop A shellcheck regression quoted `HARD` in ```shell kill "$HARD" "$pid" > /dev/null 2>&1 ``` which would error on an empty "HARD". Instead of fixing this, use `pkill` instead and also add it to the non-optional list of binaries to install, which was revised also. Fixes: https://github.com/dracutdevs/dracut/issues/1275 --- modules.d/90multipath/module-setup.sh | 15 ++++++++++----- modules.d/90multipath/multipathd-stop.sh | 16 +++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh index 48a9d09..31b1b86 100755 --- a/modules.d/90multipath/module-setup.sh +++ b/modules.d/90multipath/module-setup.sh @@ -79,12 +79,16 @@ install() { } } - inst_multiple -o \ - dmsetup \ - kpartx \ + inst_multiple \ + pkill \ + pidof \ + kpartx \ + dmsetup \ + multipath \ + multipathd + + inst_multiple -o \ mpath_wait \ - multipath \ - multipathd \ mpathpersist \ xdrgetuid \ xdrgetprio \ diff --git a/modules.d/90multipath/multipathd-stop.sh b/modules.d/90multipath/multipathd-stop.sh index 57a0728..b11c987 100755 --- a/modules.d/90multipath/multipathd-stop.sh +++ b/modules.d/90multipath/multipathd-stop.sh @@ -1,12 +1,14 @@ #!/bin/sh if [ -e /etc/multipath.conf ]; then - HARD="" - while pidof multipathd >/dev/null 2>&1; do - for pid in $(pidof multipathd); do - kill $HARD $pid >/dev/null 2>&1 - done - HARD="-9" - done + pkill multipathd > /dev/null 2>&1 + + if pidof multipathd > /dev/null 2>&1; then + sleep 0.2 + fi + + if pidofmultipathd>/dev/null 2>&1;then + pkill -9 multipathd>/dev/null 2>&1 + fi fi -- 2.33.0