modules="ptlrpc lnet_selftest ldiskfs libcfs"
fi
+if [ -f /sys/kernel/debug/kmemleak ] ; then
+ cat /proc/modules >/tmp/kmemleak-modules-list.txt
+ echo scan > /sys/kernel/debug/kmemleak
+ cat /sys/kernel/debug/kmemleak > /tmp/kmemleak-before-unload.txt
+ test -s /tmp/kmemleak-before-unload.txt && logger -t leak-pre -f /tmp/kmemleak-before-unload.txt
+ rm /tmp/kmemleak-before-unload.txt
+ # Clear everything here so that only new leaks show up
+ # after module unload
+ echo clear > /sys/kernel/debug/kmemleak
+fi
+
for mod in $modules; do
unload_dep_modules_inclusive $mod || exit 1
done
+if [ -f /sys/kernel/debug/kmemleak ] ; then
+ echo scan > /sys/kernel/debug/kmemleak
+ cat /sys/kernel/debug/kmemleak > /tmp/kmemleak-after-unload.txt
+ test -s /tmp/kmemleak-after-unload.txt && logger -t leak-mods -f /tmp/kmemleak-modules-list.txt && logger -t leak-post -f /tmp/kmemleak-after-unload.txt
+ rm -f /tmp/kmemleak-after-unload.txt /tmp/kmemleak-modules-list.txt
+fi
+
exit 0
udevadm control --reload-rules
udevadm trigger
+ # For kmemleak-enabled kernels we need clear all past state
+ # that obviously has nothing to do with this Lustre run
+ # Disable automatic memory scanning to avoid perf hit.
+ if [ -f /sys/kernel/debug/kmemleak ] ; then
+ echo scan=off > /sys/kernel/debug/kmemleak
+ echo scan > /sys/kernel/debug/kmemleak
+ echo clear > /sys/kernel/debug/kmemleak
+ fi
+
echo Loading modules from $LUSTRE
local ncpus