Skip to content

Commit

Permalink
scripts: zfs.sh: explicitly unload all modules via rmmod
Browse files Browse the repository at this point in the history
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 openzfs#13356
  • Loading branch information
nabijaczleweli authored and andrewc12 committed Sep 23, 2022
1 parent e2d4f80 commit cf18e19
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/zfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit cf18e19

Please sign in to comment.