If DEBUG is enabled, debug logs will be dumped to:
- $TMP/debug by default if DEBUG_RMMOD is unset. And if memory
leak is found, $TMP/debug will be renamed to $TMP/debug-leak.xxx;
- $DEBUG_RMMOD if $DEBUG_RMMOD is a full path name;
- $TMP/DEBUG_RMMOD if $DEBUG_RMMOD is a filename;
- standard output if DEBUG_RMMOD=- .
Memory leak in conf-sanity.sh test_29 in interop testing(LU-17962)
is used to verify this patch.
Test-Parameters: env=DEBUG=true,IGNORE_LEAK=yes,ONLY=29 \
testlist=conf-sanity serverversion=2.15 clientdistro=el8.10 \
serverdistro=el8.10 mdscount=2 mdtcount=4 ostcount=8
Test-Parameters: env=DEBUG_RMMOD=lu18390,IGNORE_LEAK=yes,ONLY=29 \
testlist=conf-sanity serverversion=2.15 clientdistro=el8.10 \
serverdistro=el8.10 mdscount=2 mdtcount=4 ostcount=8
Test-Parameters:trivial
Fixes:
255102e84e ("LU-16384 tests: dump lustre log if DEBUG_RMMOD set")
Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: I23a584541d0f9b313cf00e56f63dc4ac356c3cbc
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56767
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
SCRIPT_NAME="$(basename "$0")"
LCTL=${LCTL:-lctl}
-DEBUG='false'
-[[ -n $DEBUG_RMMOD ]] && DEBUG='true'
+if [[ -z "$DEBUG" ]]; then
+ if [[ -n "$DEBUG_RMMOD" ]]; then
+ DEBUG=true
+ else
+ DEBUG=false
+ fi
+fi
# Print help message
print_usage() {
$LCTL mark "$SCRIPT_NAME : Stop debug"
if [[ $DEBUG_RMMOD == "-" ]]; then
debug_file="" # dump to stdout
+ elif [[ "${DEBUG_RMMOD:0:1}" == "/" ]]; then
+ debug_file="$DEBUG_RMMOD"
else
- debug_file=$DEBUG_RMMOD
+ debug_file=$TMP/${DEBUG_RMMOD:-debug}
fi
+ echo "Dump memory leak logs to $debug_file"
$LCTL debug_kernel $debug_file
- DEBUG='false'
+ DEBUG=false
}
# Unload all modules dependent on $1 (exclude removal of $1)
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" ] &&
+ if [ $DEBUG -a -z $DEBUG_RMMOD ]; then
+ debug_file=$TMP/debug-leak.$(date +%s)
+ mv $TMP/debug $debug_file &&
+ echo "Save $TMP/debug to $debug_file"
+ fi
+ [[ -n "$IGNORE_LEAK" ]] &&
{ echo "ignoring leaks" && return 0; } || true
return 1
fi