Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: zfs.sh: explicitly ignore unloaded modules, explicitly unload all modules via rmmod #13356

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"
$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