aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-04-21 13:32:06 +0200
committerBrian Behlendorf <[email protected]>2022-04-21 16:33:12 -0700
commitc8871ff784731f56bab58efe6077fff38fa74c5a (patch)
treee226beb532b3d007009d1352b5aed37bfde45039
parentbee24d69295b9d31eed85f5eac7f313250aebf56 (diff)
scripts: zfs.sh: explicitly unload all modules via rmmod
modprobe -r only works for depmodded modules, but this also means we have to re-iterate legacy modules, and in the right order Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13356
-rwxr-xr-xscripts/zfs.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/zfs.sh b/scripts/zfs.sh
index 16c7f8b8d..502c5430a 100755
--- a/scripts/zfs.sh
+++ b/scripts/zfs.sh
@@ -18,7 +18,7 @@ STACK_TRACER="no"
ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid}
LDMOD=${LDMOD:-/sbin/modprobe}
-DELMOD=${DELMOD:-/sbin/modprobe -r}
+DELMOD=${DELMOD:-/sbin/rmmod}
KMOD_ZLIB_DEFLATE=${KMOD_ZLIB_DEFLATE:-zlib_deflate}
KMOD_ZLIB_INFLATE=${KMOD_ZLIB_INFLATE:-zlib_inflate}
@@ -162,9 +162,12 @@ unload_modules_freebsd() {
}
unload_modules_linux() {
- NAME="${KMOD_ZFS##*/}"
- NAME="${NAME%.ko}"
- ! [ -d "/sys/module/$NAME" ] || $DELMOD "$NAME" || return
+ legacy_kmods="icp zzstd zlua zcommon zunicode znvpair zavl"
+ for KMOD in "$KMOD_ZFS" $legacy_kmods "$KMOD_SPL"; do
+ NAME="${KMOD##*/}"
+ NAME="${NAME%.ko}"
+ ! [ -d "/sys/module/$NAME" ] || $DELMOD "$NAME" || return
+ done
if [ "$VERBOSE" = "yes" ]; then
echo "Successfully unloaded ZFS module stack"