Skip to content
Snippets Groups Projects
Commit 1f0227c6 authored by Elena Gryaznova's avatar Elena Gryaznova
Browse files

b=16001 (made by Adilger)

unload modules in order based on dependencies
parent ed4a9d1d
No related branches found
No related tags found
No related merge requests found
...@@ -232,18 +232,26 @@ wait_for_lnet() { ...@@ -232,18 +232,26 @@ wait_for_lnet() {
done done
} }
unload_dep_module() {
#lsmod output
#libcfs 107852 17 llite_lloop,lustre,obdfilter,ost,...
local MODULE=$1
local DEPS=$(lsmod | awk '($1 == "'$MODULE'") { print $4 }' | tr ',' ' ')
for SUBMOD in $DEPS; do
unload_dep_module $SUBMOD
done
[ "$MODULE" = "libcfs" ] && $LCTL dk $TMP/debug || true
$RMMOD $MODULE || true
}
unload_modules() { unload_modules() {
wait_exit_ST client # bug 12845 wait_exit_ST client # bug 12845
lsmod | grep libcfs > /dev/null && $LCTL dl lsmod | grep libcfs > /dev/null && $LCTL dl
local MODULES=$($LCTL modules | awk '{ print $2 }' | grep -v libcfs) || true unload_dep_module $FSTYPE
$RMMOD $MODULES > /dev/null 2>&1 || true unload_dep_module libcfs
# do it again, in case we tried to unload ksocklnd too early
MODULES=$($LCTL modules | awk '{ print $2 }' | grep -v libcfs) || true local MODULES=$($LCTL modules | awk '{ print $2 }')
[ -n "$MODULES" ] && $RMMOD $MODULES > /dev/null 2>&1 || true
lsmod | grep libcfs > /dev/null && $LCTL dk $TMP/debug
$RMMOD libcfs
MODULES=$($LCTL modules | awk '{ print $2 }')
if [ -n "$MODULES" ]; then if [ -n "$MODULES" ]; then
echo "Modules still loaded: " echo "Modules still loaded: "
echo $MODULES echo $MODULES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment