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

b=16799

i=Adilger
cleanup_obdclass () fix; check_mem_leak t-f fn
parent 4f239a5d
No related branches found
No related tags found
No related merge requests found
...@@ -636,10 +636,11 @@ static void cleanup_obdclass(void) ...@@ -636,10 +636,11 @@ static void cleanup_obdclass(void)
cfs_mem_cache_destroy(obd_lvfs_ctxt_cache); cfs_mem_cache_destroy(obd_lvfs_ctxt_cache);
lprocfs_free_stats(&obd_memory); lprocfs_free_stats(&obd_memory);
CDEBUG((memory_leaked | pages_leaked) ? D_ERROR : D_INFO, CDEBUG((memory_leaked) ? D_ERROR : D_INFO,
"obd_memory max: "LPU64", leaked: "LPU64" " "obd_memory max: "LPU64", leaked: "LPU64"\n",
memory_max, memory_leaked);
CDEBUG((pages_leaked) ? D_ERROR : D_INFO,
"obd_memory_pages max: "LPU64", leaked: "LPU64"\n", "obd_memory_pages max: "LPU64", leaked: "LPU64"\n",
memory_max, memory_leaked,
pages_max, pages_leaked); pages_max, pages_leaked);
EXIT; EXIT;
......
...@@ -246,6 +246,19 @@ unload_dep_module() { ...@@ -246,6 +246,19 @@ unload_dep_module() {
$RMMOD $MODULE || true $RMMOD $MODULE || true
} }
check_mem_leak () {
LEAK_LUSTRE=$(dmesg | tail -n 30 | grep "obd_memory.*leaked" || true)
LEAK_PORTALS=$(dmesg | tail -n 20 | grep "Portals memory leaked" || true)
if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
echo "$LEAK_LUSTRE" 1>&2
echo "$LEAK_PORTALS" 1>&2
mv $TMP/debug $TMP/debug-leak.`date +%s` || true
log "Memory leaks detected"
[ -n "$IGNORE_LEAK" ] && { echo "ignoring leaks" && return 0; } || true
return 1
fi
}
unload_modules() { unload_modules() {
wait_exit_ST client # bug 12845 wait_exit_ST client # bug 12845
...@@ -269,16 +282,8 @@ unload_modules() { ...@@ -269,16 +282,8 @@ unload_modules() {
fi fi
HAVE_MODULES=false HAVE_MODULES=false
LEAK_LUSTRE=$(dmesg | tail -n 30 | grep "obd mem.*leaked" || true) check_mem_leak || return 254
LEAK_PORTALS=$(dmesg | tail -n 20 | grep "Portals memory leaked" || true)
if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
echo "$LEAK_LUSTRE" 1>&2
echo "$LEAK_PORTALS" 1>&2
mv $TMP/debug $TMP/debug-leak.`date +%s` || true
echo "Memory leaks detected"
[ -n "$IGNORE_LEAK" ] && echo "ignoring leaks" && return 0
return 254
fi
echo "modules unloaded." echo "modules unloaded."
return 0 return 0
} }
...@@ -446,15 +451,8 @@ cleanup_check() { ...@@ -446,15 +451,8 @@ cleanup_check() {
[ -e $TMP/debug ] && mv $TMP/debug $TMP/debug-busy.`date +%s` [ -e $TMP/debug ] && mv $TMP/debug $TMP/debug-busy.`date +%s`
exit 205 exit 205
fi fi
LEAK_LUSTRE=`dmesg | tail -n 30 | grep "obd mem.*leaked" || true`
LEAK_PORTALS=`dmesg | tail -n 20 | grep "Portals memory leaked" || true` check_mem_leak || exit 204
if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then
echo "$0: $LEAK_LUSTRE" 1>&2
echo "$0: $LEAK_PORTALS" 1>&2
echo "$0: Memory leak(s) detected..." 1>&2
mv $TMP/debug $TMP/debug-leak.`date +%s`
exit 204
fi
[ "`lctl dl 2> /dev/null | wc -l`" -gt 0 ] && lctl dl && \ [ "`lctl dl 2> /dev/null | wc -l`" -gt 0 ] && lctl dl && \
echo "$0: lustre didn't clean up..." 1>&2 && return 202 || true echo "$0: lustre didn't clean up..." 1>&2 && return 202 || true
......
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