From f5b66eeb9790660baeed3303d519c5858cc315d4 Mon Sep 17 00:00:00 2001
From: johann <johann>
Date: Fri, 28 Dec 2007 08:25:53 +0000
Subject: [PATCH] Branch HEAD b=14398 i=johann i=bobijam

Console messages can now be disabled via lnet.printk.
---
 lustre/ChangeLog       |  5 +++++
 lustre/tests/sanity.sh | 20 ++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index b552e97e3a..46837e0849 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -560,6 +560,11 @@ Details    : When CRAY_XT3 is defined, the fsgid supplied by the client is
 	     whereas the supplied fsgid can be trusted if it is in the list of
 	     supplementary groups returned by the group upcall.
 
+Severity   : enhancement
+Bugzilla   : 14398
+Description: Allow masking D_WARNING, D_ERROR messages from console
+Details    : Console messages can now be disabled via lnet.printk.
+
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 88e48b8481..da89b092b9 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -2670,6 +2670,26 @@ test_60c() {
 }
 run_test 60c "unlink file when mds full"
 
+test_60d() {
+	SAVEPRINTK=$(sysctl -n lnet.printk)
+
+	# verify "lctl mark" is even working"
+	MESSAGE="test message ID $RANDOM $$"
+	$LCTL mark "$MESSAGE" || error "$LCTL mark failed"
+	dmesg | grep -q "$MESSAGE" || error "didn't find debug marker in log"
+
+	sysctl -w lnet.printk=0 || error "set lnet.printk failed"
+	sysctl -n lnet.printk | grep emerg || error "lnet.printk dropped emerg"
+
+	MESSAGE="new test message ID $RANDOM $$"
+	# Assume here that libcfs_debug_mark_buffer() uses D_WARNING
+	$LCTL mark "$MESSAGE" || error "$LCTL mark failed"
+	dmesg | grep -q "$MESSAGE" && error "D_WARNING wasn't masked" || true
+
+	sysctl -w lnet.printk="$SAVEPRINTK"
+}
+run_test 60d "test printk console message masking"
+
 test_61() {
 	f="$DIR/f61"
 	dd if=/dev/zero of=$f bs=`page_size` count=1
-- 
GitLab