Skip to content

Commit

Permalink
fix(multipath): revise multipathd-stop
Browse files Browse the repository at this point in the history
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: #1275
  • Loading branch information
haraldh committed Mar 31, 2021
1 parent 85378f4 commit 7b8c78f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
12 changes: 8 additions & 4 deletions modules.d/90multipath/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ install() {
fi
}

inst_multiple -o \
dmsetup \
inst_multiple \
pkill \
pidof \
kpartx \
dmsetup \
multipath \
multipathd

inst_multiple -o \
mpath_wait \
mpathconf \
mpathpersist \
multipath \
multipathd \
xdrgetprio \
xdrgetuid \
/etc/xdrdevices.conf \
Expand Down
16 changes: 9 additions & 7 deletions modules.d/90multipath/multipathd-stop.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/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 pidof multipathd > /dev/null 2>&1; then
pkill -9 multipathd > /dev/null 2>&1
fi
fi

0 comments on commit 7b8c78f

Please sign in to comment.