From dcb9169ceea7a054760a5536c4197ba20ecf31a8 Mon Sep 17 00:00:00 2001 From: Ryan Haasken Date: Thu, 5 Jun 2014 16:51:59 -0500 Subject: [PATCH] LU-5149 utils: Create debug upcall to dump ldlm namespaces Created a script to be used as the debug_log_upcall which will dump ldlm namespace information in raw/binary format and append it to the given debug log file. Signed-off-by: Ryan Haasken Change-Id: I69f08f1b9563024c962f0213fd47a95b33b7da23 Reviewed-on: http://review.whamcloud.com/10617 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Chris Horn Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/utils/Makefile.am | 3 ++- lustre/utils/ldlm_debug_upcall | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 lustre/utils/ldlm_debug_upcall diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 4995e6b..82ffcab 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -24,6 +24,7 @@ if UTILS rootsbin_PROGRAMS = mount.lustre bin_SCRIPTS = llstat llobdstat plot-llstat bin_PROGRAMS = lfs +sbin_SCRIPTS = ldlm_debug_upcall sbin_PROGRAMS = lctl l_getidentity llverfs lustre_rsync ltrack_stats if TESTS @@ -173,7 +174,7 @@ wiretest_SOURCES = wiretest.c endif # UTILS -EXTRA_DIST = llstat llobdstat plot-llstat +EXTRA_DIST = llstat llobdstat plot-llstat ldlm_debug_upcall # NOTE: this should only be run on i386. newwiretest: wirehdr.c wirecheck diff --git a/lustre/utils/ldlm_debug_upcall b/lustre/utils/ldlm_debug_upcall new file mode 100755 index 0000000..21b751f --- /dev/null +++ b/lustre/utils/ldlm_debug_upcall @@ -0,0 +1,32 @@ +#!/bin/bash +# +# usage: debug_upcall.sh +# +# Dumps locks to the Lustre kernel ring buffer and then appends the contents of +# the Lustre kernel ring buffer to the given debug log file. +# +# This is meant to be set as the debug_log_upcall, which is called by Lustre +# after dumping logs with libcfs_debug_dumplog_internal(). Lustre passes the +# upcall the name of the file to which the trace buffer was dumped. +# +# To set the Lustre debug_upcall to this script, set the debug_upcall to the +# path to this script using "lctl set_param" as follows: +# +# # lctl set_param debug_log_upcall=/path/to/this/script + +debugLogFile="$1" + +# Enable dlmtrace to get locks dumped, but save the old state first +oldDebug=$(lctl get_param -n debug) +lctl set_param debug=+dlmtrace +lctl set_param ldlm.dump_namespaces=1 + +# Dump logs in raw form +tmpLockDump=$(mktemp /tmp/lustre-ldlm-dump.XXXXX) +lctl dk $tmpLockDump 1 +# Remove the line indicating how many lines were dumped +sed '/^Debug log:/d' $tmpLockDump >> $debugLogFile +rm $tmpLockDump + +# Restore the old debug state +lctl set_param debug="$oldDebug" -- 1.8.3.1