From: bjschuma@netapp.com
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org, Bryan Schumaker <bjschuma@netapp.com>
Subject: [PATCH 2/3] NFSD: Added fault injection script
Date: Mon, 24 Oct 2011 07:20:58 -0400 [thread overview]
Message-ID: <1319455259-3136-2-git-send-email-bjschuma@netapp.com> (raw)
In-Reply-To: <1319455259-3136-1-git-send-email-bjschuma@netapp.com>
From: Bryan Schumaker <bjschuma@netapp.com>
This script provides a convenient way to use the NFSD fault injection
framework. Fault injection writes to dmesg using the KERN_INFO flag, so
this script will compare the before and after output of `dmesg` to show
the user what happened
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
tools/nfsd/inject_fault.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
create mode 100755 tools/nfsd/inject_fault.sh
diff --git a/tools/nfsd/inject_fault.sh b/tools/nfsd/inject_fault.sh
new file mode 100755
index 0000000..06a399a
--- /dev/null
+++ b/tools/nfsd/inject_fault.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com>
+#
+# Script for easier NFSD fault injection
+
+# Check that debugfs has been mounted
+DEBUGFS=`cat /proc/mounts | grep debugfs`
+if [ "$DEBUGFS" == "" ]; then
+ echo "debugfs does not appear to be mounted!"
+ echo "Please mount debugfs and try again"
+ exit 1
+fi
+
+# Check that the fault injection directory exists
+DEBUGDIR=`echo $DEBUGFS | awk '{print $2}'`/nfsd
+if [ ! -d "$DEBUGDIR" ]; then
+ echo "$DEBUGDIR does not exist"
+ echo "Check that your .config selects CONFIG_NFSD_FAULT_INJECTION"
+ exit 1
+fi
+
+function help()
+{
+ echo "Usage $0 injection_type [count]"
+ echo ""
+ echo "Injection types are:"
+ ls $DEBUGDIR
+ exit 1
+}
+
+if [ $# == 0 ]; then
+ help
+elif [ ! -f $DEBUGDIR/$1 ]; then
+ help
+elif [ $# != 2 ]; then
+ COUNT=0
+else
+ COUNT=$2
+fi
+
+BEFORE=`mktemp`
+AFTER=`mktemp`
+dmesg > $BEFORE
+echo $COUNT > $DEBUGDIR/$1
+dmesg > $AFTER
+# Capture lines that only exist in the $AFTER file
+diff $BEFORE $AFTER | grep ">"
+rm -f $BEFORE $AFTER
--
1.7.7
next prev parent reply other threads:[~2011-10-24 11:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-24 11:20 [PATCH 1/3] NFSD: Added fault injection bjschuma
2011-10-24 11:20 ` bjschuma [this message]
2011-10-24 11:20 ` [PATCH 3/3] NFSD: Added fault injection documentation bjschuma
2011-10-28 21:24 ` [PATCH 1/3] NFSD: Added fault injection J. Bruce Fields
2011-11-01 14:08 ` Bryan Schumaker
2011-11-01 14:17 ` J. Bruce Fields
2011-11-01 14:22 ` Bryan Schumaker
2011-11-01 14:35 ` J. Bruce Fields
-- strict thread matches above, loose matches on Subject: below --
2011-11-01 17:35 bjschuma
2011-11-01 17:35 ` [PATCH 2/3] NFSD: Added fault injection script bjschuma
2011-10-07 17:44 [PATCH 1/3] NFSD: Added fault injection bjschuma
2011-10-07 17:44 ` [PATCH 2/3] NFSD: Added fault injection script bjschuma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319455259-3136-2-git-send-email-bjschuma@netapp.com \
--to=bjschuma@netapp.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).