Package: kdump-tools
Version: 1.5.5-2

Given that the dumping of the dmesg buffer can be problematic when kernels
change, it would be nice to be able to turn it off. Please consider the
attached patch for inclusion.

...Juerg
From 36281407d2f99ed8deb29a4f4c3d94506c1ccec5 Mon Sep 17 00:00:00 2001
From: Juerg Haefliger <juerg.haefli...@hp.com>
Date: Tue, 6 May 2014 07:44:45 +0000
Subject: [PATCH] Make the dumping of dmesg configurable

Dumping the dmesg buffer has shown to be problematic when kernels change
and it is not that useful of a feature in a production environment. This
patch introduces a new config variable that can turn the dmesg dump off.
The default behaviour unchanged, i.e., the dmesg buffer is dumped.
---
 debian/kdump-config        | 36 ++++++++++++++++++++----------------
 debian/kdump-tools.5       |  3 +++
 debian/kdump-tools.default |  4 ++++
 3 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/debian/kdump-config b/debian/kdump-config
index 2e6cad9..b196214 100755
--- a/debian/kdump-config
+++ b/debian/kdump-config
@@ -44,6 +44,7 @@ ARCH=`uname -m`
 # Set up defaults
 KDUMP_SYSCTL=${KDUMP_SYSCTL:="kernel.panic_on_oops=1"}
 KDUMP_COREDIR=${KDUMP_COREDIR:=/var/crash}
+KDUMP_DUMP_DMESG=${KDUMP_DUMP_DMESG:=1}
 MAKEDUMP_ARGS=${MAKEDUMP_ARGS:="-c -d 31"}
 KDUMP_CMDLINE_APPEND=${KDUMP_CMDLINE_APPEND:="irqpoll maxcpus=1 nousb"}
 [ -d $KDUMP_COREDIR ] || mkdir -p $KDUMP_COREDIR ;
@@ -337,23 +338,26 @@ function kdump_save_core()
 		logger -t $NAME "failed to save vmcore in $KDUMP_STAMPDIR"
 	fi
 
-	log_action_msg "running makedumpfile --dump-dmesg $vmcore_file $KDUMP_DMESGFILE"
-	makedumpfile --dump-dmesg $vmcore_file $KDUMP_DMESGFILE
-	ERROR=$?
-	if [ $ERROR -ne 0 ] ; then
-		log_failure_msg "$NAME: makedumpfile --dump-dmesg failed. dmesg content will be unavailable"
-		logger -t $NAME "makedumpfile --dump-dmesg failed. dmesg content will be unavailable"
-	fi
+	# dump the dmesg buffer
+	if [ $KDUMP_DUMP_DMESG -eq 1 ] ; then
+		log_action_msg "running makedumpfile --dump-dmesg $vmcore_file $KDUMP_DMESGFILE"
+		makedumpfile --dump-dmesg $vmcore_file $KDUMP_DMESGFILE
+		ERROR=$?
+		if [ $ERROR -ne 0 ] ; then
+			log_failure_msg "$NAME: makedumpfile --dump-dmesg failed. dmesg content will be unavailable"
+			logger -t $NAME "makedumpfile --dump-dmesg failed. dmesg content will be unavailable"
+		fi
 
-	# did we succeed?
-	if [ $ERROR == 0 ]; then
-		log_success_msg "$NAME: saved dmesg content in $KDUMP_STAMPDIR"
-		logger -t $NAME "saved dmesg content in $KDUMP_STAMPDIR"
-		return 0;
-	else
-		log_failure_msg "$NAME: failed to save dmesg content in $KDUMP_STAMPDIR"
-		logger -t $NAME "failed to save dmesg content in $KDUMP_STAMPDIR"
-		return 1;
+		# did we succeed?
+		if [ $ERROR == 0 ]; then
+			log_success_msg "$NAME: saved dmesg content in $KDUMP_STAMPDIR"
+			logger -t $NAME "saved dmesg content in $KDUMP_STAMPDIR"
+			return 0;
+		else
+			log_failure_msg "$NAME: failed to save dmesg content in $KDUMP_STAMPDIR"
+			logger -t $NAME "failed to save dmesg content in $KDUMP_STAMPDIR"
+			return 1;
+		fi
 	fi
 }
 
diff --git a/debian/kdump-tools.5 b/debian/kdump-tools.5
index 0d18361..c4d932c 100644
--- a/debian/kdump-tools.5
+++ b/debian/kdump-tools.5
@@ -83,6 +83,9 @@ will be used.
 .B KDUMP_FAIL_CMD
 This variable specifies a command to run if the vmcore save fails.
 If not set, no special action is taken.
+.TP
+.B KDUMP_DUMP_DMESG
+This variable controls if the dmesg buffer is dumped.  If not set or set to 1, the dmesg buffer is dumped.  If set to 0, the dmesg buffer is not dumped.
 .\"
 .\" 
 .\"
diff --git a/debian/kdump-tools.default b/debian/kdump-tools.default
index 8d02da0..b93613a 100644
--- a/debian/kdump-tools.default
+++ b/debian/kdump-tools.default
@@ -34,8 +34,12 @@ USE_KDUMP=0
 #     is the default.
 #     Example - start a shell if the vmcore copy fails:
 #         KDUMP_FAIL_CMD="echo 'makedumpfile FAILED.'; /bin/bash; reboot -f"
+# KDUMP_DUMP_DMESG - This variable controls if the dmesg buffer is dumped.
+#     If unset or set to 1, the dmesg buffer is dumped. If set to 0, the dmesg
+#     buffer is not dumped.
 KDUMP_COREDIR="/var/crash"
 #KDUMP_FAIL_CMD="reboot -f"
+#KDUMP_DUMP_DMESG=
 
 
 # ---------------------------------------------------------------------------
-- 
2.0.0.rc0

Reply via email to